Skip to main content

route_tools

Function route_tools 

Source
pub async fn route_tools(
    handler: &dyn DynToolHandler,
    method: &str,
    params: Option<&Value>,
    ctx: &Context<'_>,
    page_size: Option<usize>,
) -> Option<Result<Value, McpError>>
Expand description

Route tool-related requests to a handler implementing ToolHandler.

This function handles tools/list and tools/call methods. Returns None if the method is not tool-related.

§Example

if let Some(result) = route_tools(&handler, method, params, &ctx).await {
    return result;
}