pub struct CratesDocsHandler { /* private fields */ }Expand description
MCP server handler
Implementations§
Source§impl CratesDocsHandler
impl CratesDocsHandler
Sourcepub fn new(server: Arc<CratesDocsServer>) -> Self
pub fn new(server: Arc<CratesDocsServer>) -> Self
Create a new handler
Trait Implementations§
Source§impl ServerHandler for CratesDocsHandler
impl ServerHandler for CratesDocsHandler
Source§fn handle_list_tools_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_list_tools_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle list tools request
Source§fn handle_call_tool_request<'life0, 'async_trait>(
&'life0 self,
params: CallToolRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_call_tool_request<'life0, 'async_trait>(
&'life0 self,
params: CallToolRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle call tool request
Source§fn handle_list_resources_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_list_resources_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle list resources request
Source§fn handle_read_resource_request<'life0, 'async_trait>(
&'life0 self,
_params: ReadResourceRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_read_resource_request<'life0, 'async_trait>(
&'life0 self,
_params: ReadResourceRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle read resource request
Source§fn handle_list_prompts_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_list_prompts_request<'life0, 'async_trait>(
&'life0 self,
_request: Option<PaginatedRequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle list prompts request
Source§fn handle_get_prompt_request<'life0, 'async_trait>(
&'life0 self,
_params: GetPromptRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_get_prompt_request<'life0, 'async_trait>(
&'life0 self,
_params: GetPromptRequestParams,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle get prompt request
Source§fn on_initialized<'life0, 'async_trait>(
&'life0 self,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_initialized<'life0, 'async_trait>(
&'life0 self,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Invoked when the server finishes initialization and receives an
initialized_notification from the client. Read moreSource§fn handle_initialize_request<'life0, 'async_trait>(
&'life0 self,
params: InitializeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<InitializeResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_initialize_request<'life0, 'async_trait>(
&'life0 self,
params: InitializeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<InitializeResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles the InitializeRequest from a client. Read more
Source§fn handle_ping_request<'life0, 'async_trait>(
&'life0 self,
_params: Option<RequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_ping_request<'life0, 'async_trait>(
&'life0 self,
_params: Option<RequestParams>,
_runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles ping requests from clients. Read more
Source§fn handle_list_resource_templates_request<'life0, 'async_trait>(
&'life0 self,
params: Option<PaginatedRequestParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_list_resource_templates_request<'life0, 'async_trait>(
&'life0 self,
params: Option<PaginatedRequestParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles requests to list resource templates. Read more
Source§fn handle_subscribe_request<'life0, 'async_trait>(
&'life0 self,
params: SubscribeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_subscribe_request<'life0, 'async_trait>(
&'life0 self,
params: SubscribeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles subscription requests from clients. Read more
Source§fn handle_unsubscribe_request<'life0, 'async_trait>(
&'life0 self,
params: UnsubscribeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_unsubscribe_request<'life0, 'async_trait>(
&'life0 self,
params: UnsubscribeRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles unsubscribe requests from clients. Read more
Source§fn handle_task_augmented_tool_call<'life0, 'async_trait>(
&'life0 self,
params: CallToolRequestParams,
task_creator: TaskCreator<ClientJsonrpcRequest, ResultFromServer>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CreateTaskResult, CallToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_task_augmented_tool_call<'life0, 'async_trait>(
&'life0 self,
params: CallToolRequestParams,
task_creator: TaskCreator<ClientJsonrpcRequest, ResultFromServer>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CreateTaskResult, CallToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles requests to call a task-augmented tool.
you need to returns a CreateTaskResult containing task data.
The actual operation result becomes available later
through tasks/result after the task completes.
Source§fn handle_set_level_request<'life0, 'async_trait>(
&'life0 self,
params: SetLevelRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_set_level_request<'life0, 'async_trait>(
&'life0 self,
params: SetLevelRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles requests to enable or adjust logging level. Read more
Source§fn handle_complete_request<'life0, 'async_trait>(
&'life0 self,
params: CompleteRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_complete_request<'life0, 'async_trait>(
&'life0 self,
params: CompleteRequestParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles completion requests from clients. Read more
Source§fn handle_get_task_request<'life0, 'async_trait>(
&'life0 self,
params: GetTaskParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetTaskResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_get_task_request<'life0, 'async_trait>(
&'life0 self,
params: GetTaskParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetTaskResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles a request to retrieve the state of a task.
Source§fn handle_get_task_payload_request<'life0, 'async_trait>(
&'life0 self,
params: GetTaskPayloadParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetTaskPayloadResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_get_task_payload_request<'life0, 'async_trait>(
&'life0 self,
params: GetTaskPayloadParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<GetTaskPayloadResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles a request to retrieve the result of a completed task.
Source§fn handle_cancel_task_request<'life0, 'async_trait>(
&'life0 self,
params: CancelTaskParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CancelTaskResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_cancel_task_request<'life0, 'async_trait>(
&'life0 self,
params: CancelTaskParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<CancelTaskResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles a request to cancel a task.
Source§fn handle_list_task_request<'life0, 'async_trait>(
&'life0 self,
params: Option<PaginatedRequestParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_list_task_request<'life0, 'async_trait>(
&'life0 self,
params: Option<PaginatedRequestParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles a request to retrieve a list of tasks.
Source§fn handle_custom_request<'life0, 'async_trait>(
&'life0 self,
request: CustomRequest,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_custom_request<'life0, 'async_trait>(
&'life0 self,
request: CustomRequest,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<Result, RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handles custom requests not defined in the standard protocol. Read more
Source§fn handle_initialized_notification<'life0, 'async_trait>(
&'life0 self,
params: Option<NotificationParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_initialized_notification<'life0, 'async_trait>(
&'life0 self,
params: Option<NotificationParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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.
Source§fn handle_cancelled_notification<'life0, 'async_trait>(
&'life0 self,
params: CancelledNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_cancelled_notification<'life0, 'async_trait>(
&'life0 self,
params: CancelledNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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.
Source§fn handle_progress_notification<'life0, 'async_trait>(
&'life0 self,
params: ProgressNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_progress_notification<'life0, 'async_trait>(
&'life0 self,
params: ProgressNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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.
Source§fn handle_roots_list_changed_notification<'life0, 'async_trait>(
&'life0 self,
params: Option<NotificationParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_roots_list_changed_notification<'life0, 'async_trait>(
&'life0 self,
params: Option<NotificationParams>,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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.
Source§fn handle_task_status_notification<'life0, 'async_trait>(
&'life0 self,
params: TaskStatusNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_task_status_notification<'life0, 'async_trait>(
&'life0 self,
params: TaskStatusNotificationParams,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
handles a notification from the receiver to the requestor, informing them that a task’s status has changed.
Source§fn handle_custom_notification<'life0, 'async_trait>(
&'life0 self,
notification: CustomRequest,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn handle_custom_notification<'life0, 'async_trait>(
&'life0 self,
notification: CustomRequest,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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.
Source§fn handle_error<'life0, 'life1, 'async_trait>(
&'life0 self,
error: &'life1 RpcError,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn handle_error<'life0, 'life1, 'async_trait>(
&'life0 self,
error: &'life1 RpcError,
runtime: Arc<dyn McpServer>,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Handles server errors that occur during operation. Read more
Auto Trait Implementations§
impl Freeze for CratesDocsHandler
impl !RefUnwindSafe for CratesDocsHandler
impl Send for CratesDocsHandler
impl Sync for CratesDocsHandler
impl Unpin for CratesDocsHandler
impl UnsafeUnpin for CratesDocsHandler
impl !UnwindSafe for CratesDocsHandler
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