pub enum McpEvent {
ServerStatusChanged {
server_id: String,
status: ServerStatus,
error: Option<String>,
},
ToolsChanged {
server_id: String,
tools: Vec<String>,
},
ToolExecuted {
server_id: String,
tool_name: String,
success: bool,
},
}Expand description
Event emitted by the MCP manager.
Represents state changes and operations in the MCP system. Events are used for monitoring, logging, and reactive updates.
§Variants
ServerStatusChanged- Server connection status changedToolsChanged- Server’s tool list was updatedToolExecuted- A tool was invoked (success or failure)
§Monitoring
Subscribe to these events to monitor server health, track tool usage, or implement reactive UI updates.
§Example
ⓘ
match event {
McpEvent::ServerStatusChanged { server_id, status, error } => {
println!("Server {} is now {:?}", server_id, status);
}
McpEvent::ToolExecuted { server_id, tool_name, success } => {
println!("Tool {} on {} - success: {}", tool_name, server_id, success);
}
_ => {}
}Variants§
ServerStatusChanged
Server connection status changed
Fields
§
status: ServerStatusNew status
ToolsChanged
Server’s available tools changed
ToolExecuted
Tool was executed
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpEvent
impl RefUnwindSafe for McpEvent
impl Send for McpEvent
impl Sync for McpEvent
impl Unpin for McpEvent
impl UnsafeUnpin for McpEvent
impl UnwindSafe for McpEvent
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