pub enum McpNotification {
ToolsListChanged,
ResourcesListChanged,
PromptsListChanged,
Progress {
progress_token: String,
progress: f64,
total: Option<f64>,
},
LogMessage {
level: LogLevel,
logger: Option<String>,
message: String,
data: Option<Value>,
},
Custom {
method: String,
params: Option<Value>,
},
}Expand description
Notification types that can be sent from server to client.
MCP supports various notification types for real-time updates. Notifications are one-way messages from server to client and don’t expect a response.
§Notification Types
ToolsListChanged: Notify when available tools have changedResourcesListChanged: Notify when available resources have changedPromptsListChanged: Notify when available prompts have changedProgress: Send progress updates for long-running operationsLogMessage: Send log messages with different severity levelsCustom: Send custom notifications with arbitrary method names
§Examples
use solidmcp::handler::{McpNotification, LogLevel};
use serde_json::json;
// Send a log message
let notification = McpNotification::LogMessage {
level: LogLevel::Info,
logger: Some("file_processor".to_string()),
message: "Processing complete".to_string(),
data: Some(json!({
"files_processed": 42,
"duration_ms": 1234
})),
};
// Send progress update
let progress = McpNotification::Progress {
progress_token: "task-123".to_string(),
progress: 25.0,
total: Some(100.0),
};
// Notify about resource changes
let resource_update = McpNotification::ResourcesListChanged;Variants§
ToolsListChanged
Tools have changed
ResourcesListChanged
Resources have changed
PromptsListChanged
Prompts have changed
Progress
Progress notification
LogMessage
Log message
Custom
Custom notification
Trait Implementations§
Source§impl Clone for McpNotification
impl Clone for McpNotification
Source§fn clone(&self) -> McpNotification
fn clone(&self) -> McpNotification
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for McpNotification
impl RefUnwindSafe for McpNotification
impl Send for McpNotification
impl Sync for McpNotification
impl Unpin for McpNotification
impl UnsafeUnpin for McpNotification
impl UnwindSafe for McpNotification
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