Skip to main content

Crate mcpr_protocol

Crate mcpr_protocol 

Source

Modules§

error_code

Structs§

JsonRpcError
JsonRpcNotification
JsonRpcRequest
JsonRpcResponse
ParsedBody
Result of parsing a POST body as JSON-RPC 2.0.

Enums§

JsonRpcId
A parsed JSON-RPC 2.0 id (number or string).
JsonRpcMessage
A classified JSON-RPC 2.0 message.
McpMethod
Known MCP methods — lets the proxy know exactly what function is being called.

Constants§

COMPLETION_COMPLETE
INITIALIZE
INITIALIZED
LOGGING_SET_LEVEL
PING
PROMPTS_GET
PROMPTS_LIST
RESOURCES_LIST
RESOURCES_READ
RESOURCES_SUBSCRIBE
RESOURCES_UNSUBSCRIBE
TOOLS_CALL
TOOLS_LIST

Functions§

error_response
Build a JSON-RPC 2.0 error response as bytes. id can be a request id or Value::Null if the request id couldn’t be parsed.
extract_error_code
Extract the JSON-RPC error code from a response body (if it’s an error response).
parse_body
Parse a POST body as JSON-RPC 2.0 — single message or batch. Returns None if the body is not valid JSON-RPC 2.0.
parse_message
Parse a single JSON value as a JSON-RPC 2.0 message. Returns None if it doesn’t have "jsonrpc": "2.0".