Expand description
Newline-delimited JSON-RPC framing for the stdio binding.
Bounded newline-delimited JSON-RPC over a byte stream (SDK-017 R1, the stdio binding SDK-014 R2 names): one message per line, no embedded newline, a line over the limit refused by name and drained so the next line is read whole.
Enums§
- Frame
Error - Why a line could not be read as a message.
- Incoming
- A message read from the host.
Constants§
- INVALID_
PARAMS - JSON-RPC’s invalid-params code.
- INVALID_
REQUEST - JSON-RPC’s invalid-request code.
- METHOD_
NOT_ FOUND - JSON-RPC’s method-not-found code.
- PARSE_
ERROR - JSON-RPC’s parse error code.
- UNSUPPORTED_
PROTOCOL_ VERSION - MCP 2026-07-28’s unsupported-protocol-version code.
Functions§
- error
- An error response for
id(nullwhen the request’s id could not be read), with optionaldata. - parse
- A JSON value as a JSON-RPC 2.0 request or notification.
- read_
message - Reads one line of at most
limitbytes.Ok(None)is the host closing its end. A line over the limit is drained to its newline and refused. - result
- A result response for
id. - write_
message - Writes one message as one line and flushes it. The message is serialised
by
serde_json, which never emits a raw newline inside a string.