pub struct ServerMessageHandler {
pub info: Implementation,
pub capabilities: ServerCapabilities,
pub resources: ResourceRegistry,
pub tools: ToolRegistry,
pub prompts: PromptRegistry,
}Expand description
Server message handler that implements the MCP protocol
Fields§
§info: Implementation§capabilities: ServerCapabilities§resources: ResourceRegistry§tools: ToolRegistry§prompts: PromptRegistryImplementations§
Source§impl ServerMessageHandler
impl ServerMessageHandler
pub fn new( info: Implementation, capabilities: ServerCapabilities, resources: ResourceRegistry, tools: ToolRegistry, prompts: PromptRegistry, ) -> Self
Trait Implementations§
Source§impl MessageHandler for ServerMessageHandler
impl MessageHandler for ServerMessageHandler
Source§fn handle_initialize<'life0, 'async_trait>(
&'life0 self,
request: InitializeRequest,
) -> Pin<Box<dyn Future<Output = Result<InitializeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_initialize<'life0, 'async_trait>(
&'life0 self,
request: InitializeRequest,
) -> Pin<Box<dyn Future<Output = Result<InitializeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an initialize request
Source§fn handle_resources_list<'life0, 'async_trait>(
&'life0 self,
request: ResourcesListRequest,
) -> Pin<Box<dyn Future<Output = Result<ResourcesListResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_resources_list<'life0, 'async_trait>(
&'life0 self,
request: ResourcesListRequest,
) -> Pin<Box<dyn Future<Output = Result<ResourcesListResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_resources_read<'life0, 'async_trait>(
&'life0 self,
request: ResourcesReadRequest,
) -> Pin<Box<dyn Future<Output = Result<ResourcesReadResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_resources_subscribe<'life0, 'async_trait>(
&'life0 self,
request: ResourcesSubscribeRequest,
) -> Pin<Box<dyn Future<Output = Result<ResourcesSubscribeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_resources_unsubscribe<'life0, 'async_trait>(
&'life0 self,
request: ResourcesUnsubscribeRequest,
) -> Pin<Box<dyn Future<Output = Result<ResourcesUnsubscribeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_tools_list<'life0, 'async_trait>(
&'life0 self,
request: ToolsListRequest,
) -> Pin<Box<dyn Future<Output = Result<ToolsListResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_tools_call<'life0, 'async_trait>(
&'life0 self,
request: ToolsCallRequest,
) -> Pin<Box<dyn Future<Output = Result<ToolsCallResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_prompts_list<'life0, 'async_trait>(
&'life0 self,
request: PromptsListRequest,
) -> Pin<Box<dyn Future<Output = Result<PromptsListResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_prompts_get<'life0, 'async_trait>(
&'life0 self,
request: PromptsGetRequest,
) -> Pin<Box<dyn Future<Output = Result<PromptsGetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle prompts/get request
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,
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,
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_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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
Auto Trait Implementations§
impl !RefUnwindSafe for ServerMessageHandler
impl !UnwindSafe for ServerMessageHandler
impl Freeze for ServerMessageHandler
impl Send for ServerMessageHandler
impl Sync for ServerMessageHandler
impl Unpin for ServerMessageHandler
impl UnsafeUnpin for ServerMessageHandler
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