Available on crate feature
mcp only.Expand description
JSON-RPC 2.0 + MCP protocol types (issue #420).
A minimal, hand-rolled subset of the Model Context Protocol
— enough to serve initialize, tools/list, tools/call, resources/list,
resources/read, and ping over any byte transport. Kept dependency-free
(just serde_json) so the mcp feature adds no new crate tree.
Structs§
- Json
RpcRequest - An incoming JSON-RPC request or notification.
- ToolDef
- A tool definition advertised via
tools/list.
Constants§
- INTERNAL_
ERROR - INVALID_
PARAMS - INVALID_
REQUEST - METHOD_
NOT_ FOUND - PARSE_
ERROR - JSON-RPC 2.0 standard error codes.
- PROTOCOL_
VERSION - MCP protocol version this server implements/advertises.
Functions§
- error
- Build an error response envelope for
id. - error_
no_ id - An error whose
idis unknown (e.g. an unparseable request): JSON-RPC requiresid: nullin that case. - success
- Build a success response envelope for
idwithresult. - tool_
error - Wrap a tool error in the MCP
tools/callcontent shape (isError: true). - tool_
text - Wrap a tool’s textual result in the MCP
tools/callcontent shape.