Expand description
MCP protocol types — JSON-RPC 2.0 and Model Context Protocol messages.
This module is a functional core: pure data types with serde
serialization. No IO, no side effects. All parsing and building
happens through serde_json.
Structs§
- Initialize
Result - The result of
initialize. - Json
RpcError - The
errorobject inside a JSON-RPC error response. - Json
RpcError Response - A JSON-RPC 2.0 error response.
- Json
RpcRequest - A JSON-RPC 2.0 request (or notification when
idis None). - Json
RpcResponse - A JSON-RPC 2.0 success response.
- Server
Capabilities - Server capabilities advertised during initialization.
- Server
Info - Server info returned during initialization.
- Tool
Call Params - Parameters for
tools/call. - Tool
Call Result - The result of
tools/call. - Tool
Definition - A tool definition returned by
tools/list. - Tool
List Result - The result of
tools/list. - Tool
Result Content - A single content item in a tool result.
- Tools
Capability - Indicates the server supports tools.
Constants§
Functions§
- build_
initialize_ result - Build the initialize result for this server.
- error_
response - Build a JSON-RPC error response.
- error_
response_ with_ data - Build a JSON-RPC error response with extra data.
- parse_
request - Parse a raw JSON string into a
JsonRpcRequest. - success_
response - Build a JSON-RPC success response.
- tool_
result_ error - Build an error tool result.
- tool_
result_ json - Build a JSON tool result (serializes value to pretty-printed text).
- tool_
result_ text - Build a successful text tool result.