Trait ClientHandler

Source
pub trait ClientHandler:
    Send
    + Sync
    + 'static {
Show 14 methods // Provided methods fn handle_ping_request<'life0, 'life1, 'async_trait>( &'life0 self, request: PingRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_create_message_request<'life0, 'life1, 'async_trait>( &'life0 self, request: CreateMessageRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResult, RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_list_roots_request<'life0, 'life1, 'async_trait>( &'life0 self, request: ListRootsRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<ListRootsResult, 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 McpClient, ) -> Pin<Box<dyn Future<Output = Result<ListRootsResult, 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 McpClient, ) -> 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 McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_resource_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ResourceListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_resource_updated_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ResourceUpdatedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_prompt_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: PromptListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_tool_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ToolListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_logging_message_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: LoggingMessageNotification, runtime: &'life1 dyn McpClient, ) -> 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, 'life1, 'async_trait>( &'life0 self, notification: Value, runtime: &'life1 dyn McpClient, ) -> 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 McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn handle_process_error<'life0, 'life1, 'async_trait>( &'life0 self, error_message: String, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

Defines the ClientHandler trait for handling Model Context Protocol (MCP) operations on a client. This trait provides default implementations for request and notification handlers in an MCP client, allowing developers to override methods for custom behavior.

Provided Methods§

Source

fn handle_ping_request<'life0, 'life1, 'async_trait>( &'life0 self, request: PingRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_create_message_request<'life0, 'life1, 'async_trait>( &'life0 self, request: CreateMessageRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_list_roots_request<'life0, 'life1, 'async_trait>( &'life0 self, request: ListRootsRequest, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<ListRootsResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_custom_request<'life0, 'life1, 'async_trait>( &'life0 self, request: Value, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<ListRootsResult, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_cancelled_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: CancelledNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_progress_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ProgressNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_resource_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ResourceListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_resource_updated_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ResourceUpdatedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_prompt_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: PromptListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_tool_list_changed_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: ToolListChangedNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_logging_message_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: LoggingMessageNotification, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_custom_notification<'life0, 'life1, 'async_trait>( &'life0 self, notification: Value, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_error<'life0, 'life1, 'async_trait>( &'life0 self, error: RpcError, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn handle_process_error<'life0, 'life1, 'async_trait>( &'life0 self, error_message: String, runtime: &'life1 dyn McpClient, ) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§