Pure JSON-RPC 2.0 codec for the slice of MCP that mead speaks as a client: initialize,
notifications/initialized, tools/list, and tools/call.
Encoders return one-line JSON binaries (the JSON encoder escapes newlines inside strings), so a
stdio transport can frame messages with a trailing newline. decode/1 never raises.
Summary
Functions
Tells the server that nobody waits for the answer to request id any more.
The one protocol version this client negotiates.
Types
@type decoded() :: {:response, request_id(), map()} | {:error_response, request_id(), %{code: integer(), message: String.t(), data: term()}} | {:request, request_id(), String.t(), map()} | {:notification, String.t(), map()} | {:invalid, :not_binary | :malformed_json | :not_jsonrpc | :result_and_error | :unrecognized}
Functions
@spec call_tool_request(request_id(), String.t(), map()) :: binary()
@spec cancelled_notification(request_id(), String.t()) :: binary()
Tells the server that nobody waits for the answer to request id any more.
@spec error_response(request_id() | nil, integer(), String.t()) :: binary()
@spec initialize_request(request_id()) :: binary()
@spec initialized_notification() :: binary()
@spec list_tools_request(request_id(), String.t() | nil) :: binary()
@spec protocol_version() :: String.t()
The one protocol version this client negotiates.
@spec result_response(request_id(), map()) :: binary()