Expand description
Typed tool definition framework and dispatch router. Typed tool definition framework.
Provides the ToolHandler trait for
implementing tools as named types. Attach a handler to a
Tool via
Tool::with_handler, then install
the resulting tools on a session via
SessionConfig::with_tools.
The SDK builds an internal name-keyed registry from the handlers and
dispatches to the matching handler when the CLI broadcasts
external_tool.requested.
Enable the derive feature for schema_for, which generates JSON
Schema from Rust types via schemars.
Traits§
- Json
Schema - Re-export of
schemars::JsonSchemafor deriving tool parameter schemas. A type which can be described as a JSON Schema document. - Tool
Handler - A client-defined tool’s runtime implementation.
Functions§
- convert_
mcp_ call_ tool_ result - Convert an MCP
CallToolResultJSON value into a Copilot tool result. - define_
tool - Define a
Toolfrom an async function (or closure) that takes a typed,JsonSchema-derived parameter struct. - define_
tool_ declaration - Define a declaration-only
Toolwith a JSON Schema derived fromP. - schema_
for - Generate a JSON Schema
Valuefrom a Rust type. - tool_
parameters - Convert a JSON Schema
Valueinto theTool::parametersmap shape expected by the protocol. - try_
tool_ parameters - Fallible variant of
tool_parametersfor callers handling dynamic schema input.
Derive Macros§
- Json
Schema - Re-export of
schemars::JsonSchemafor deriving tool parameter schemas. Derive macro forJsonSchematrait.