Expand description
Tool trait, registry and the shapes handlers return. Handlers get a RequestContext and
return structured results; the protocol layer turns them into MCP results.
Re-exports§
pub use error::ToolError;pub use error::ToolErrorCode;pub use handler::Tool;pub use handler::ToolHandler;pub use handler::ToolRegistry;
Modules§
- args
- Tool arguments. Their JSON Schemas are the tools’ input schemas; keep field docs short, every schema must stay well under the clients’ size limits.
- catalog
- Every tool’s name, description, annotations and scope. The input schema comes from the handler’s arguments.
- error 🔒
- The errors tools return, and how each reaches the agent.
- handler 🔒
- The tool handler trait and the registry dispatch looks tools up in.
- schema
- Input schema generation: draft 2020-12, no
oneOf/anyOfand no nullable type arrays, so the schemas survive Codex’s schema sanitiser.
Structs§
- Confirmation
Request - A human decision the handler needs before it can finish, such as confirming a risky publish.
- McpPrincipal
- Who an MCP request acts for, from a validated access token.
- Request
Context - Everything a handler knows about the request besides its arguments.
- Retry
State - Echoed state of a confirmation round trip, already verified.
- Tool
Result - A structured tool result. Hints live inside the structured object because clients drop the text content when structured content is present.
Enums§
- McpScope
- A capability an MCP token can carry.
- Tool
Outcome - How a handler call ended.
Constants§
- CONFIRMATION_
KEY 🔒 - Key of the confirmation in the input requests and responses.
Functions§
- off_
worker 🔒 - Runs CPU-heavy pure work, such as an engine pass over every page, on the blocking pool, so that the worker thread keeps serving other requests meanwhile.