pub enum MCPMessage {
Show 21 variants
Initialize {
protocol_version: String,
capabilities: MCPCapabilities,
client_info: MCPClientInfo,
},
InitializeResult {
protocol_version: String,
capabilities: MCPCapabilities,
server_info: MCPServerInfo,
},
ListTools {
cursor: Option<String>,
},
ListToolsResult {
tools: Vec<MCPTool>,
next_cursor: Option<String>,
},
CallTool {
name: String,
arguments: Value,
},
CallToolResult {
content: Vec<MCPContent>,
is_error: bool,
},
ListPrompts {
cursor: Option<String>,
},
ListPromptsResult {
prompts: Vec<MCPPrompt>,
next_cursor: Option<String>,
},
GetPrompt {
name: String,
arguments: Option<Value>,
},
GetPromptResult {
description: Option<String>,
messages: Vec<MCPPromptMessage>,
},
ListResources {
cursor: Option<String>,
},
ListResourcesResult {
resources: Vec<MCPResource>,
next_cursor: Option<String>,
},
ReadResource {
uri: String,
},
ReadResourceResult {
contents: Vec<MCPResourceContent>,
},
SubscribeResource {
uri: String,
},
UnsubscribeResource {
uri: String,
},
ResourceUpdated {
uri: String,
},
ListLogs {
cursor: Option<String>,
},
ListLogsResult {
logs: Vec<MCPLogEntry>,
next_cursor: Option<String>,
},
SetLogLevel {
level: MCPLogLevel,
},
Error {
code: i32,
message: String,
data: Option<Value>,
},
}
Expand description
MCP message types
Variants§
Initialize
Initialize MCP session
Fields
§
capabilities: MCPCapabilities
Client capabilities for this session
§
client_info: MCPClientInfo
Information about the connecting client
InitializeResult
Initialize response
Fields
§
capabilities: MCPCapabilities
Server capabilities for this session
§
server_info: MCPServerInfo
Information about the MCP server
ListTools
List available tools
ListToolsResult
List tools response
Fields
CallTool
Call a tool
CallToolResult
Tool call response
Fields
§
content: Vec<MCPContent>
Content returned by the tool
ListPrompts
List available prompts
ListPromptsResult
List prompts response
Fields
GetPrompt
Get a prompt
Fields
GetPromptResult
Get prompt response
Fields
§
messages: Vec<MCPPromptMessage>
Prompt messages/content
ListResources
List available resources
ListResourcesResult
List resources response
Fields
§
resources: Vec<MCPResource>
Available resources on this server
ReadResource
Read a resource
ReadResourceResult
Read resource response
Fields
§
contents: Vec<MCPResourceContent>
Contents of the requested resource
SubscribeResource
Subscribe to resource
UnsubscribeResource
Unsubscribe from resource
ResourceUpdated
Resource updated notification
ListLogs
List logs
ListLogsResult
List logs response
Fields
§
logs: Vec<MCPLogEntry>
Log entries available on this server
SetLogLevel
Set log level
Fields
§
level: MCPLogLevel
Log level to set for the server
Error
Error response
Trait Implementations§
Source§impl Clone for MCPMessage
impl Clone for MCPMessage
Source§fn clone(&self) -> MCPMessage
fn clone(&self) -> MCPMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MCPMessage
impl Debug for MCPMessage
Source§impl<'de> Deserialize<'de> for MCPMessage
impl<'de> Deserialize<'de> for MCPMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MCPMessage
impl RefUnwindSafe for MCPMessage
impl Send for MCPMessage
impl Sync for MCPMessage
impl Unpin for MCPMessage
impl UnwindSafe for MCPMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more