module Network.MCP.Client.Types
( Client(..)
, ClientConfig(..)
, McpClientError(..)
) where
import Control.Concurrent.MVar
import Control.Exception (Exception)
import Data.Aeson (Value)
import System.IO (Handle)
import System.Process
import qualified Data.Text as T
data McpClientError
= ConnectionError T.Text
| ProtocolError T.Text
| ServerError
{ McpClientError -> Maybe Int
serverErrorCode :: Maybe Int
, McpClientError -> Text
serverErrorMessage :: T.Text
, McpClientError -> Maybe Value
serverErrorData :: Maybe Value
}
deriving (Int -> McpClientError -> ShowS
[McpClientError] -> ShowS
McpClientError -> String
(Int -> McpClientError -> ShowS)
-> (McpClientError -> String)
-> ([McpClientError] -> ShowS)
-> Show McpClientError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> McpClientError -> ShowS
showsPrec :: Int -> McpClientError -> ShowS
$cshow :: McpClientError -> String
show :: McpClientError -> String
$cshowList :: [McpClientError] -> ShowS
showList :: [McpClientError] -> ShowS
Show)
instance Exception McpClientError
data ClientConfig = ClientConfig
{ ClientConfig -> Text
clientName :: T.Text
, ClientConfig -> Text
clientVersion :: T.Text
, ClientConfig -> Value
clientCapabilities :: Value
}
data Client = Client
{ Client -> ClientConfig
clientConfig :: ClientConfig
, Client -> MVar (Maybe ProcessHandle)
clientProcess :: MVar (Maybe ProcessHandle)
, Client -> MVar (Maybe Handle)
clientStdin :: MVar (Maybe Handle)
, Client -> MVar (Maybe Handle)
clientStdout :: MVar (Maybe Handle)
}