Skip to main content

Module protocol

Module protocol 

Source
Expand description

MCP JSON-RPC Protocol Types

This module defines the core JSON-RPC 2.0 protocol types used for communicating with Model Context Protocol (MCP) servers.

Re-exports§

pub use crate::MCP_PROTOCOL_VERSION;

Modules§

error_codes
Standard JSON-RPC error codes

Structs§

Annotations
Optional annotations for the client.
BaseMetadata
Base metadata with name (identifier) and title (display name) properties.
BooleanSchema
Boolean schema for elicitation forms.
CallToolParams
MCP tools/call request parameters
CallToolResult
MCP tools/call response
CancelTaskParams
Parameters for tasks/cancel request.
CompleteArgument
Argument information for completion.
CompleteContext
Additional context for completions.
CompleteParams
Parameters for completion/complete request.
CompleteResult
Response to a completion/complete request.
CompletionData
Completion data.
CreateMessageParams
Parameters for sampling/createMessage request.
CreateMessageResult
The client’s response to a sampling/createMessage request.
CreateTaskResult
A response to a task-augmented request.
ElicitRequestFormParams
Parameters for elicitation/create request with form mode.
ElicitRequestUrlParams
Parameters for elicitation/create request with URL mode.
ElicitResult
The client’s response to an elicitation request.
ElicitationCompleteParams
Parameters for notifications/elicitation/complete notification.
GetTaskParams
Parameters for tasks/get request.
GetTaskPayloadParams
Parameters for tasks/result request.
Icon
An optionally-sized icon that can be displayed in a user interface.
Implementation
MCP Implementation info (server or client). Describes the MCP implementation with name, version, icons, and description.
JsonRpcError
JSON-RPC 2.0 Error
JsonRpcNotification
JSON-RPC 2.0 Notification (no id, no response expected)
JsonRpcRequest
JSON-RPC 2.0 Request
JsonRpcResponse
JSON-RPC 2.0 Response
ListRootsResult
Response to a roots/list request.
ListTasksParams
Parameters for tasks/list request.
ListTasksResult
Response to a tasks/list request.
ListToolsParams
MCP tools/list request parameters
ListToolsResult
MCP tools/list response
LoggingMessageParams
Parameters for notifications/message notification.
McpCapabilities
MCP server capabilities (legacy format).
McpToolDefinition
MCP Tool Definition (from tools/list response)
ModelHint
Hints to use for model selection.
ModelPreferences
The server’s preferences for model selection.
MultiSelectEnumItems
Multi-select enum item schema (untitled).
NumberSchema
Number schema for elicitation forms.
ProgressNotificationParams
Parameters for notifications/progress notification.
PromptReference
A reference to a prompt.
RelatedTaskMetadata
Metadata for associating messages with a task.
ResourceTemplateReference
A reference to a resource or resource template.
Root
Represents a root directory or file that the server can operate on.
SamplingMessage
Describes a message issued to or received from an LLM API.
SetLevelParams
Parameters for logging/setLevel request.
StringSchema
String schema for elicitation forms.
Task
Data associated with a task.
TaskMetadata
Metadata for augmenting a request with task execution.
TaskStatusNotificationParams
Parameters for notifications/tasks/status notification.
TitledEnumOption
Single-select enum option with title.
TitledMultiSelectEnumItems
Multi-select enum item schema (titled).
ToolAnnotations
Additional properties describing a Tool to clients. NOTE: all properties in ToolAnnotations are hints.
ToolChoice
Controls tool selection behavior for sampling requests.
ToolExecution
Execution-related properties for a tool.
ToolInputSchema
JSON Schema for tool inputs (legacy format)
ToolResultContent
The result of a tool use, provided by the user back to the assistant.
ToolUseContent
A request from the assistant to call a tool.

Enums§

ClientInbound
Inbound message from client to server.
ElicitAction
User action in response to an elicitation.
ElicitRequestParams
Parameters for elicitation/create request.
IconTheme
Theme specifier for an icon.
JsonRpcId
JSON-RPC ID can be string, number, or null
JsonRpcMessage
A JSON-RPC message that can be any of request, response, or notification. Used for parsing incoming messages when the type is unknown.
JsonRpcPayload
LoggingLevel
The severity of a log message (RFC-5424 syslog severities).
ProgressToken
A progress token, used to associate progress notifications with the original request.
Role
The sender or recipient of messages and data in a conversation.
SamplingContent
Sampling message content block types.
ServerOutbound
Outbound message from server to client.
StopReason
Standard stop reasons for sampling.
StringSchemaFormat
Format options for string schema.
TaskStatus
The status of a task.
TaskSupport
Indicates whether a tool supports task-augmented execution.
ToolChoiceMode
Controls tool selection behavior for sampling requests.
ToolContent
Tool execution content (text, image, audio, or resource types)

Type Aliases§

McpServerInfo
MCP server information (legacy alias for Implementation).