Safe Haskell | None |
---|---|
Language | GHC2024 |
MCP.Server.JsonRpc
Contents
Synopsis
- data JsonRpcRequest = JsonRpcRequest {}
- data JsonRpcResponse = JsonRpcResponse {}
- data JsonRpcError = JsonRpcError {}
- data JsonRpcNotification = JsonRpcNotification {}
- data JsonRpcMessage
- data RequestId
- makeSuccessResponse :: RequestId -> Value -> JsonRpcResponse
- makeErrorResponse :: RequestId -> JsonRpcError -> JsonRpcResponse
- makeNotification :: Text -> Maybe Value -> JsonRpcNotification
- parseJsonRpcMessage :: Value -> Either String JsonRpcMessage
- encodeJsonRpcMessage :: JsonRpcMessage -> Value
JSON-RPC Types
data JsonRpcRequest Source #
JSON-RPC request
Constructors
JsonRpcRequest | |
Fields
|
Instances
data JsonRpcResponse Source #
JSON-RPC response
Constructors
JsonRpcResponse | |
Fields |
Instances
Generic JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc Associated Types
Methods from :: JsonRpcResponse -> Rep JsonRpcResponse x # to :: Rep JsonRpcResponse x -> JsonRpcResponse # | |||||
Show JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc Methods showsPrec :: Int -> JsonRpcResponse -> ShowS # show :: JsonRpcResponse -> String # showList :: [JsonRpcResponse] -> ShowS # | |||||
Eq JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc Methods (==) :: JsonRpcResponse -> JsonRpcResponse -> Bool # (/=) :: JsonRpcResponse -> JsonRpcResponse -> Bool # | |||||
FromJSON JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc Methods parseJSON :: Value -> Parser JsonRpcResponse # parseJSONList :: Value -> Parser [JsonRpcResponse] # | |||||
ToJSON JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc Methods toJSON :: JsonRpcResponse -> Value # toEncoding :: JsonRpcResponse -> Encoding # toJSONList :: [JsonRpcResponse] -> Value # toEncodingList :: [JsonRpcResponse] -> Encoding # omitField :: JsonRpcResponse -> Bool # | |||||
type Rep JsonRpcResponse Source # | |||||
Defined in MCP.Server.JsonRpc type Rep JsonRpcResponse = D1 ('MetaData "JsonRpcResponse" "MCP.Server.JsonRpc" "mcp-server-0.1.0.8-inplace" 'False) (C1 ('MetaCons "JsonRpcResponse" 'PrefixI 'True) ((S1 ('MetaSel ('Just "responseJsonrpc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "responseId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RequestId)) :*: (S1 ('MetaSel ('Just "responseResult") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Value)) :*: S1 ('MetaSel ('Just "responseError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe JsonRpcError))))) |
data JsonRpcError Source #
JSON-RPC error
Constructors
JsonRpcError | |
Instances
Generic JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc Associated Types
| |||||
Show JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc Methods showsPrec :: Int -> JsonRpcError -> ShowS # show :: JsonRpcError -> String # showList :: [JsonRpcError] -> ShowS # | |||||
Eq JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc | |||||
FromJSON JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc | |||||
ToJSON JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc Methods toJSON :: JsonRpcError -> Value # toEncoding :: JsonRpcError -> Encoding # toJSONList :: [JsonRpcError] -> Value # toEncodingList :: [JsonRpcError] -> Encoding # omitField :: JsonRpcError -> Bool # | |||||
type Rep JsonRpcError Source # | |||||
Defined in MCP.Server.JsonRpc type Rep JsonRpcError = D1 ('MetaData "JsonRpcError" "MCP.Server.JsonRpc" "mcp-server-0.1.0.8-inplace" 'False) (C1 ('MetaCons "JsonRpcError" 'PrefixI 'True) (S1 ('MetaSel ('Just "errorCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "errorMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "errorData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Value))))) |
data JsonRpcNotification Source #
JSON-RPC notification
Constructors
JsonRpcNotification | |
Fields |
Instances
Generic JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc Associated Types
Methods from :: JsonRpcNotification -> Rep JsonRpcNotification x # to :: Rep JsonRpcNotification x -> JsonRpcNotification # | |||||
Show JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc Methods showsPrec :: Int -> JsonRpcNotification -> ShowS # show :: JsonRpcNotification -> String # showList :: [JsonRpcNotification] -> ShowS # | |||||
Eq JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc Methods (==) :: JsonRpcNotification -> JsonRpcNotification -> Bool # (/=) :: JsonRpcNotification -> JsonRpcNotification -> Bool # | |||||
FromJSON JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc Methods parseJSON :: Value -> Parser JsonRpcNotification # parseJSONList :: Value -> Parser [JsonRpcNotification] # | |||||
ToJSON JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc Methods toJSON :: JsonRpcNotification -> Value # toEncoding :: JsonRpcNotification -> Encoding # toJSONList :: [JsonRpcNotification] -> Value # toEncodingList :: [JsonRpcNotification] -> Encoding # omitField :: JsonRpcNotification -> Bool # | |||||
type Rep JsonRpcNotification Source # | |||||
Defined in MCP.Server.JsonRpc type Rep JsonRpcNotification = D1 ('MetaData "JsonRpcNotification" "MCP.Server.JsonRpc" "mcp-server-0.1.0.8-inplace" 'False) (C1 ('MetaCons "JsonRpcNotification" 'PrefixI 'True) (S1 ('MetaSel ('Just "notificationJsonrpc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "notificationMethod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "notificationParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Value))))) |
data JsonRpcMessage Source #
Union type for all JSON-RPC messages
Constructors
JsonRpcMessageRequest JsonRpcRequest | |
JsonRpcMessageResponse JsonRpcResponse | |
JsonRpcMessageNotification JsonRpcNotification |
Instances
Generic JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc Associated Types
Methods from :: JsonRpcMessage -> Rep JsonRpcMessage x # to :: Rep JsonRpcMessage x -> JsonRpcMessage # | |||||
Show JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc Methods showsPrec :: Int -> JsonRpcMessage -> ShowS # show :: JsonRpcMessage -> String # showList :: [JsonRpcMessage] -> ShowS # | |||||
Eq JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc Methods (==) :: JsonRpcMessage -> JsonRpcMessage -> Bool # (/=) :: JsonRpcMessage -> JsonRpcMessage -> Bool # | |||||
FromJSON JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc Methods parseJSON :: Value -> Parser JsonRpcMessage # parseJSONList :: Value -> Parser [JsonRpcMessage] # | |||||
ToJSON JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc Methods toJSON :: JsonRpcMessage -> Value # toEncoding :: JsonRpcMessage -> Encoding # toJSONList :: [JsonRpcMessage] -> Value # toEncodingList :: [JsonRpcMessage] -> Encoding # omitField :: JsonRpcMessage -> Bool # | |||||
type Rep JsonRpcMessage Source # | |||||
Defined in MCP.Server.JsonRpc type Rep JsonRpcMessage = D1 ('MetaData "JsonRpcMessage" "MCP.Server.JsonRpc" "mcp-server-0.1.0.8-inplace" 'False) (C1 ('MetaCons "JsonRpcMessageRequest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsonRpcRequest)) :+: (C1 ('MetaCons "JsonRpcMessageResponse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsonRpcResponse)) :+: C1 ('MetaCons "JsonRpcMessageNotification" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JsonRpcNotification)))) |
JSON-RPC request ID
Constructors
RequestIdText Text | |
RequestIdNumber Int | |
RequestIdNull |
Instances
Generic RequestId Source # | |||||
Defined in MCP.Server.JsonRpc Associated Types
| |||||
Show RequestId Source # | |||||
Eq RequestId Source # | |||||
FromJSON RequestId Source # | |||||
Defined in MCP.Server.JsonRpc | |||||
ToJSON RequestId Source # | |||||
type Rep RequestId Source # | |||||
Defined in MCP.Server.JsonRpc type Rep RequestId = D1 ('MetaData "RequestId" "MCP.Server.JsonRpc" "mcp-server-0.1.0.8-inplace" 'False) (C1 ('MetaCons "RequestIdText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: (C1 ('MetaCons "RequestIdNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "RequestIdNull" 'PrefixI 'False) (U1 :: Type -> Type))) |
JSON-RPC Functions
makeSuccessResponse :: RequestId -> Value -> JsonRpcResponse Source #
Create a successful JSON-RPC response
makeErrorResponse :: RequestId -> JsonRpcError -> JsonRpcResponse Source #
Create an error JSON-RPC response
makeNotification :: Text -> Maybe Value -> JsonRpcNotification Source #
Create a JSON-RPC notification
parseJsonRpcMessage :: Value -> Either String JsonRpcMessage Source #
Parse a JSON-RPC message from bytes
encodeJsonRpcMessage :: JsonRpcMessage -> Value Source #
Encode a JSON-RPC message to bytes