route_tools

Function route_tools 

Source
pub async fn route_tools<TH>(
    handler: &TH,
    method: &str,
    params: Option<&Value>,
    ctx: &Context<'_>,
) -> Option<Result<Value, McpError>>
where TH: ToolHandler + Send + Sync,
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;
}