Skip to main content

Module protocol

Module protocol 

Source
Expand description

Agent Client Protocol wire types.

JSON-RPC 2.0 messages, newline-delimited, one compact message per line. Field names are camelCase and discriminator values are snake_case, per the spec.

Every type a client sends us is permissive on deserialize - unknown fields are ignored and every optional field carries #[serde(default)] - because real hosts differ in how much of the spec they populate. Gas City, for instance, sends initialize with only protocolVersion and clientInfo and no clientCapabilities at all.

Modules§

error_codes
Standard JSON-RPC 2.0 error codes.

Structs§

AgentCapabilities
Agent-side capabilities advertised at initialize.
AgentInfo
An agent’s identity.
ClientCapabilities
Client-side capabilities advertised at initialize.
ContentBlock
One block of prompt or message content.
EmbeddedResource
A resource inlined into a prompt (the embeddedContext capability).
InitializeParams
Params of the initialize request.
InitializeResult
Result of the initialize request.
JsonRpcError
A JSON-RPC 2.0 error object.
JsonRpcMessage
A JSON-RPC 2.0 message: request, response, or notification depending on which fields are set.
PermissionOption
One choice offered in a permission request.
PromptCapabilities
Prompt content kinds an agent accepts.
RequestPermissionParams
Params of an outbound session/request_permission request.
RequestPermissionResult
Result of a session/request_permission request.
SessionCancelParams
Params of the session/cancel notification.
SessionNewParams
Params of the session/new request.
SessionNewResult
Result of the session/new request.
SessionPromptParams
Params of the session/prompt request.
SessionPromptResult
Result of the session/prompt request.
SessionUpdateParams
Params of an outbound session/update notification.
ToolCallRef
The tool call a permission request refers to.

Enums§

PermissionOptionKind
What selecting a permission option means.
PermissionOutcome
The user’s decision on a permission request.
SessionUpdate
One session/update payload, discriminated by sessionUpdate.
StopReason
Why a prompt turn ended.
ToolCallStatus
A tool call’s lifecycle status.
ToolKind
The category of operation a tool performs.

Constants§

MAX_FRAME_BYTES
The largest single JSON frame (one line) we will ever write.
PROTOCOL_VERSION
The protocol MAJOR version this crate speaks.