Skip to main content

MessageHandler

Trait MessageHandler 

Source
pub trait MessageHandler: Send + Sync {
Show 23 methods // Required method fn handle_initialize<'life0, 'async_trait>( &'life0 self, request: InitializeRequest, ) -> Pin<Box<dyn Future<Output = Result<InitializeResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided methods fn handle_initialized<'life0, 'async_trait>( &'life0 self, _notification: InitializedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_ping<'life0, 'async_trait>( &'life0 self, request: PingRequest, ) -> Pin<Box<dyn Future<Output = Result<PingResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_resources_list<'life0, 'async_trait>( &'life0 self, _request: ResourcesListRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesListResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_resources_read<'life0, 'async_trait>( &'life0 self, _request: ResourcesReadRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesReadResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_resources_subscribe<'life0, 'async_trait>( &'life0 self, _request: ResourcesSubscribeRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesSubscribeResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_resources_unsubscribe<'life0, 'async_trait>( &'life0 self, _request: ResourcesUnsubscribeRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesUnsubscribeResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_tools_list<'life0, 'async_trait>( &'life0 self, _request: ToolsListRequest, ) -> Pin<Box<dyn Future<Output = Result<ToolsListResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_tools_call<'life0, 'async_trait>( &'life0 self, _request: ToolsCallRequest, ) -> Pin<Box<dyn Future<Output = Result<ToolsCallResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_prompts_list<'life0, 'async_trait>( &'life0 self, _request: PromptsListRequest, ) -> Pin<Box<dyn Future<Output = Result<PromptsListResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_prompts_get<'life0, 'async_trait>( &'life0 self, _request: PromptsGetRequest, ) -> Pin<Box<dyn Future<Output = Result<PromptsGetResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_logging_set_level<'life0, 'async_trait>( &'life0 self, _request: LoggingSetLevelRequest, ) -> Pin<Box<dyn Future<Output = Result<LoggingSetLevelResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_sampling_create_message<'life0, 'async_trait>( &'life0 self, _request: CreateMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_roots_list<'life0, 'async_trait>( &'life0 self, _request: RootsListRequest, ) -> Pin<Box<dyn Future<Output = Result<RootsListResponse, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_progress_notification<'life0, 'async_trait>( &'life0 self, _notification: ProgressNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_logging_notification<'life0, 'async_trait>( &'life0 self, _notification: LoggingNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_cancelled_notification<'life0, 'async_trait>( &'life0 self, _notification: CancelledNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_resources_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: ResourcesUpdatedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_tools_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: ToolsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_prompts_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: PromptsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_roots_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: RootsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn handle_custom_request<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, _params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... } fn handle_custom_notification<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, _params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait { ... }
}
Expand description

Trait for handling MCP protocol messages

Required Methods§

Source

fn handle_initialize<'life0, 'async_trait>( &'life0 self, request: InitializeRequest, ) -> Pin<Box<dyn Future<Output = Result<InitializeResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle an initialize request

Provided Methods§

Source

fn handle_initialized<'life0, 'async_trait>( &'life0 self, _notification: InitializedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle an initialized notification

Source

fn handle_ping<'life0, 'async_trait>( &'life0 self, request: PingRequest, ) -> Pin<Box<dyn Future<Output = Result<PingResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle a ping request

Source

fn handle_resources_list<'life0, 'async_trait>( &'life0 self, _request: ResourcesListRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesListResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle resources/list request

Source

fn handle_resources_read<'life0, 'async_trait>( &'life0 self, _request: ResourcesReadRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesReadResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle resources/read request

Source

fn handle_resources_subscribe<'life0, 'async_trait>( &'life0 self, _request: ResourcesSubscribeRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesSubscribeResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle resources/subscribe request

Source

fn handle_resources_unsubscribe<'life0, 'async_trait>( &'life0 self, _request: ResourcesUnsubscribeRequest, ) -> Pin<Box<dyn Future<Output = Result<ResourcesUnsubscribeResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle resources/unsubscribe request

Source

fn handle_tools_list<'life0, 'async_trait>( &'life0 self, _request: ToolsListRequest, ) -> Pin<Box<dyn Future<Output = Result<ToolsListResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle tools/list request

Source

fn handle_tools_call<'life0, 'async_trait>( &'life0 self, _request: ToolsCallRequest, ) -> Pin<Box<dyn Future<Output = Result<ToolsCallResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle tools/call request

Source

fn handle_prompts_list<'life0, 'async_trait>( &'life0 self, _request: PromptsListRequest, ) -> Pin<Box<dyn Future<Output = Result<PromptsListResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle prompts/list request

Source

fn handle_prompts_get<'life0, 'async_trait>( &'life0 self, _request: PromptsGetRequest, ) -> Pin<Box<dyn Future<Output = Result<PromptsGetResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle prompts/get request

Source

fn handle_logging_set_level<'life0, 'async_trait>( &'life0 self, _request: LoggingSetLevelRequest, ) -> Pin<Box<dyn Future<Output = Result<LoggingSetLevelResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle logging/setLevel request

Source

fn handle_sampling_create_message<'life0, 'async_trait>( &'life0 self, _request: CreateMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<CreateMessageResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle sampling/createMessage request (client capability)

Source

fn handle_roots_list<'life0, 'async_trait>( &'life0 self, _request: RootsListRequest, ) -> Pin<Box<dyn Future<Output = Result<RootsListResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle roots/list request (client capability)

Source

fn handle_progress_notification<'life0, 'async_trait>( &'life0 self, _notification: ProgressNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle progress notification

Source

fn handle_logging_notification<'life0, 'async_trait>( &'life0 self, _notification: LoggingNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle logging notification

Source

fn handle_cancelled_notification<'life0, 'async_trait>( &'life0 self, _notification: CancelledNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle cancelled notification

Source

fn handle_resources_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: ResourcesUpdatedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle resources updated notification

Source

fn handle_tools_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: ToolsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle tools updated notification

Source

fn handle_prompts_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: PromptsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle prompts updated notification

Source

fn handle_roots_updated_notification<'life0, 'async_trait>( &'life0 self, _notification: RootsListChangedNotification, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Handle roots updated notification

Source

fn handle_custom_request<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, _params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Handle custom/unknown requests

Source

fn handle_custom_notification<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, _params: Option<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Handle custom/unknown notifications

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§