Skip to main content

Module jsonrpc

Module jsonrpc 

Source
Expand description

The protocol-neutral JSON-RPC layer.

§What belongs here

JSON-RPC 2.0 has no knowledge of MCP, and neither does anything in this module. The envelope, the id, the error codes, and the decode step are the same for an MCP session, an A2A session, and an ACP session — which is the property that lets a later task add a protocol as a feature-gated module rather than a fork of the transport layer.

The converse boundary is enforced by the module layout rather than by discipline: the method table that says tools/call exists lives in crate::application::jsonrpc as a trait, and its MCP implementation lives under adapters. Nothing here names a method.

§The two views of a message

OwnedBorrowed
modulecrate::domain::irthis one
holdscrate::domain::ir::IrMessageFrame
costsan allocation per string idnone
used whena message has to be stored, logged, or replayeda message is being routed

They are not two versions of the same thing and neither replaces the other. The borrowed view is what the hot path uses, because routing a frame should not allocate; the owned view is what the session engine and the transports use, because those keep messages past the life of the read buffer.

Re-exports§

pub use envelope::DecodeError;
pub use envelope::Envelope;
pub use envelope::Frame;
pub use envelope::MessageKind;
pub use envelope::Method;
pub use envelope::Outcome;
pub use envelope::WireError;
pub use envelope::WireId;
pub use envelope::WireIdError;
pub use envelope::decode;
pub use crate::domain::RequestId;
pub use crate::domain::ir::IrErrorCode;

Modules§

envelope
The borrowed JSON-RPC envelope — what a frame is, before anything decides what to do about it.
reply
The reply document, assembled from a dispatched result and a request id.