Skip to main content

Module jsonrpc

Module jsonrpc 

Source
Expand description

JSON-RPC 2.0 messages as MCP exchanges them, and the client’s errors. Port of protocol/jsonrpc.ts in pi-mcp v1.0.0.

Enums§

Incoming
A message as received, classified.
McpError
Why an MCP request or connection failed. Messages match pi-mcp’s.

Constants§

INTERNAL_ERROR
The handler failed.
INVALID_REQUEST
The request was not valid JSON-RPC.
METHOD_NOT_FOUND
The method does not exist.

Functions§

classify
Classifies a message, or None when it is not valid JSON-RPC.
id_key
A key for an id, so string "1" and number 1 stay distinct.
is_id
Whether value can be a JSON-RPC id: a string or a finite number.