#[non_exhaustive]pub enum McpRequest {
Show 19 variants
Initialize(InitializeParams),
ListTools(ListToolsParams),
CallTool(CallToolParams),
ListResources(ListResourcesParams),
ListResourceTemplates(ListResourceTemplatesParams),
ReadResource(ReadResourceParams),
SubscribeResource(SubscribeResourceParams),
UnsubscribeResource(UnsubscribeResourceParams),
ListPrompts(ListPromptsParams),
GetPrompt(GetPromptParams),
GetTaskInfo(GetTaskInfoParams),
UpdateTask(UpdateTaskParams),
CancelTask(CancelTaskParams),
Ping,
SetLoggingLevel(SetLogLevelParams),
Complete(CompleteParams),
Discover(DiscoverParams),
SubscriptionsListen(SubscriptionsListenParams),
Unknown {
method: String,
params: Option<Value>,
},
}Expand description
High-level MCP request (parsed from JSON-RPC)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Initialize(InitializeParams)
Initialize session
ListTools(ListToolsParams)
List available tools
CallTool(CallToolParams)
Call a tool
ListResources(ListResourcesParams)
List available resources
ListResourceTemplates(ListResourceTemplatesParams)
List resource templates
ReadResource(ReadResourceParams)
Read a resource
SubscribeResource(SubscribeResourceParams)
Subscribe to resource updates
UnsubscribeResource(UnsubscribeResourceParams)
Unsubscribe from resource updates
ListPrompts(ListPromptsParams)
List available prompts
GetPrompt(GetPromptParams)
Get a prompt
GetTaskInfo(GetTaskInfoParams)
Get task info (tasks/get).
UpdateTask(UpdateTaskParams)
Update an in-flight task with inputResponses (tasks/update).
Introduced by SEP-2663 to replace the blocking tasks/result method
from the 2025-11-25 experimental spec. The response is an empty ack;
task state is observed via tasks/get.
CancelTask(CancelTaskParams)
Cancel a task (tasks/cancel).
Ping
Ping (keepalive)
SetLoggingLevel(SetLogLevelParams)
Set logging level
Complete(CompleteParams)
Request completion suggestions
Discover(DiscoverParams)
SEP-2575: discover server capabilities without an initialize handshake
SubscriptionsListen(SubscriptionsListenParams)
SEP-2575 / SEP-2567: open a server-to-client notification stream
(subscriptions/listen).
The HTTP transport intercepts this before it reaches the router and returns an SSE stream. The variant is defined here for client-side type-safe construction and for any future transport implementations.
Unknown
Unknown method
Implementations§
Source§impl McpRequest
impl McpRequest
Sourcepub fn method_name(&self) -> &str
pub fn method_name(&self) -> &str
Get the method name for this request
Source§impl McpRequest
impl McpRequest
Sourcepub fn from_jsonrpc(req: &JsonRpcRequest) -> Result<McpRequest, Error>
pub fn from_jsonrpc(req: &JsonRpcRequest) -> Result<McpRequest, Error>
Parse from JSON-RPC request
Trait Implementations§
Source§impl Clone for McpRequest
impl Clone for McpRequest
Source§fn clone(&self) -> McpRequest
fn clone(&self) -> McpRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more