Skip to main content

Module tools

Module tools 

Source
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/anyOf and no nullable type arrays, so the schemas survive Codex’s schema sanitiser.

Structs§

ConfirmationRequest
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.
RequestContext
Everything a handler knows about the request besides its arguments.
RetryState
Echoed state of a confirmation round trip, already verified.
ToolResult
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.
ToolOutcome
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.