Expand description
Module defining tool related structs and traits.
The Tool trait defines a simple interface for creating tools that can be used by Agents.
The ToolEmbedding trait extends the Tool trait to allow for tools that can be stored in a vector store and RAGged.
The ToolSet struct is a collection of tools that can be used by an Agent and optionally RAGged.
§Structured tool results
A tool call resolves to a structured ToolExecutionResult — model-visible
output, a machine-readable ToolOutcome (success, a classified
ToolFailure, skipped, or denied), and ToolResultExtensions metadata
that is never sent to the model. This is what flows to the
StepEvent::ToolResult hook so a
policy can steer on why a tool failed without parsing strings. A tool
classifies its own error type via Tool::classify_error and can return
richer outcomes/metadata via Tool::call_structured and ToolReturn.
Modules§
- builtin
- Built-in tools shipped with
rigthat agents can use out of the box. - rmcp
rmcp - MCP (Model Context Protocol) integration via the
rmcpcrate. - server
Structs§
- Missing
Extension - Error returned by
ToolCallExtensions::requireandToolResultExtensions::requirewhen the requested value is not present. - Tool
Call Extensions - Per-call runtime extensions supplied to a tool by its caller.
- Tool
Execution Result - The full structured result of a single tool execution.
- Tool
Failure - A structured, model-independent description of a tool execution failure.
- Tool
Result Extensions - Type-erased metadata a tool attaches to its structured result.
- Tool
Return - A tool’s return value carrying an optional structured outcome and metadata.
- ToolSet
- A struct that holds a set of tools.
- Tool
SetBuilder - Builder for constructing a
ToolSetwith static and dynamic tools.
Enums§
- Tool
Error - Tool
Failure Kind - How a tool execution failed, as a closed set of standard kinds.
- Tool
Outcome - The structured outcome of a tool call: what happened, independent of the model-visible text.
- Tool
Return Outcome - The outcome a tool declares for a call it executed.
- Tool
SetError
Traits§
- Tool
- Trait that represents a simple LLM tool.
- ToolDyn
- Wrapper trait to allow for dynamic dispatch of simple tools.
- Tool
Embedding - Trait that represents an LLM tool that can be stored in a vector store and RAGged
- Tool
Embedding Dyn - Wrapper trait to allow for dynamic dispatch of raggable tools
Functions§
- tool_
definition - Generate a provider-facing
ToolDefinitionfrom a registered tool’s flat metadata.