Skip to main content

tool

Function tool 

Source
pub fn tool<A, F, Fut>(
    name: &'static str,
    description: &'static str,
    handler: F,
) -> ToolRoute<McpServer>
where A: DeserializeOwned + JsonSchema + Send + 'static, F: Fn(CommandSender, A) -> Fut + Send + Sync + 'static, Fut: Future<Output = ToolResult> + Send + 'static,
Available on crate feature mcp and non-WebAssembly only.
Expand description

A tool route from a name, a description and an asynchronous handler.

The handler receives the command channel it sends its work over and the arguments the client passed. Its argument type derives [JsonSchema], so the advertised input schema is the one this crate’s own tools advertise too.