pub trait ServerHandler:
Send
+ Sync
+ 'static {
Show 22 methods
// Provided methods
fn on_initialized<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_initialize_request<'life0, 'life1, 'async_trait>(
&'life0 self,
initialize_request: InitializeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<InitializeResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_ping_request<'life0, 'life1, 'async_trait>(
&'life0 self,
__arg1: PingRequest,
_: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_list_resources_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourcesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_list_resource_templates_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourceTemplatesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_read_resource_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ReadResourceRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_subscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_unsubscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: UnsubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_list_prompts_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListPromptsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_get_prompt_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GetPromptRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_list_tools_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListToolsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_call_tool_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CallToolRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_set_level_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SetLevelRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_complete_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompleteRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_custom_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Value,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_initialized_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: InitializedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: CancelledNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: ProgressNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_roots_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: RootsListChangedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_custom_notification<'life0, 'async_trait>(
&'life0 self,
notification: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn handle_error<'life0, 'life1, 'async_trait>(
&'life0 self,
error: RpcError,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_server_started<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
Defines the ServerHandler
trait for handling Model Context Protocol (MCP) operations on a server.
This trait provides default implementations for request and notification handlers in an MCP server,
allowing developers to override methods for custom behavior.
Provided Methods§
Sourcefn on_initialized<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_initialized<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoked when the server finishes initialization and receives an initialized_notification
from the client.
The runtime
parameter provides access to the server’s runtime environment, allowing
interaction with the server’s capabilities.
The default implementation does nothing.
Sourcefn handle_initialize_request<'life0, 'life1, 'async_trait>(
&'life0 self,
initialize_request: InitializeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<InitializeResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_initialize_request<'life0, 'life1, 'async_trait>(
&'life0 self,
initialize_request: InitializeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<InitializeResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles the InitializeRequest from a client.
§Arguments
initialize_request
- The initialization request containing client parametersruntime
- Reference to the MCP server runtime
§Returns
Returns the server info as InitializeResult on success or a JSON-RPC error on failure Do not override this unless the standard initialization process doesn’t work for you or you need to modify it.
Sourcefn handle_ping_request<'life0, 'life1, 'async_trait>(
&'life0 self,
__arg1: PingRequest,
_: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_ping_request<'life0, 'life1, 'async_trait>(
&'life0 self,
__arg1: PingRequest,
_: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles ping requests from clients.
§Returns
By default, it returns an empty result structure Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_list_resources_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourcesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_list_resources_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourcesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to list available resources.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_list_resource_templates_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourceTemplatesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_list_resource_templates_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListResourceTemplatesRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to list resource templates.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_read_resource_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ReadResourceRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_read_resource_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ReadResourceRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to read a specific resource.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_subscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_subscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles subscription requests from clients.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_unsubscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: UnsubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_unsubscribe_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: UnsubscribeRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles unsubscribe requests from clients.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_list_prompts_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListPromptsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_list_prompts_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListPromptsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to list available prompts.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_get_prompt_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GetPromptRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_get_prompt_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GetPromptRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to get a specific prompt.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_list_tools_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListToolsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_list_tools_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ListToolsRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to list available tools.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_call_tool_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CallToolRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_call_tool_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CallToolRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to call a specific tool.
Default implementation returns an unknown tool error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_set_level_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SetLevelRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_set_level_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: SetLevelRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles requests to enable or adjust logging level.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_complete_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompleteRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_complete_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompleteRequest,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles completion requests from clients.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_custom_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Value,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_custom_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: Value,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles custom requests not defined in the standard protocol.
Default implementation returns method not found error. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_initialized_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: InitializedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_initialized_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: InitializedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles initialized notifications from clients. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: CancelledNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_cancelled_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: CancelledNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles cancelled operation notifications. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: ProgressNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_progress_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: ProgressNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles progress update notifications. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_roots_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: RootsListChangedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_roots_list_changed_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
notification: RootsListChangedNotification,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles notifications received from the client indicating that the list of roots has changed Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_custom_notification<'life0, 'async_trait>(
&'life0 self,
notification: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_custom_notification<'life0, 'async_trait>(
&'life0 self,
notification: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handles custom notifications not defined in the standard protocol. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn handle_error<'life0, 'life1, 'async_trait>(
&'life0 self,
error: RpcError,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_error<'life0, 'life1, 'async_trait>(
&'life0 self,
error: RpcError,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles server errors that occur during operation.
§Arguments
error
- The error that occurredruntime
- Reference to the MCP server runtime Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.
Sourcefn on_server_started<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_server_started<'life0, 'life1, 'async_trait>(
&'life0 self,
runtime: &'life1 dyn McpServer,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when the server has successfully started.
Sends a “Server started successfully” message to stderr. Customize this function in your specific handler to implement behavior tailored to your MCP server’s capabilities and requirements.