Expand description
Tool authoring contracts, dispatch context, and canonical execution values.
PortableTool provides context-free calls; Tool adds ToolContext.
Both can be adapted into ErasedTool handlers.
use rig_core::tool::ToolOutput;
let output = ToolOutput::json(serde_json::json!({"count": 3}));
assert!(output.as_json().is_some());Re-exports§
pub use context::ContextValue;pub use context::PublishedContext;pub use context::ToolContext;pub use context::ToolContextError;pub use context::ToolResultContext;pub use contextual::DynamicTool;pub use contextual::ErasedTool;pub use contextual::LivenessFn;pub use contextual::Tool;pub use contextual::ToolEmbedding;pub use contextual::tool_definition;pub use managed::ManagedToolSink;pub use managed::ManagedToolToken;pub use portable::PortableTool;pub use portable::PortableToolEmbedding;
Modules§
- builtin
- Built-in tools shipped with
rigthat agents can use out of the box. - context
- Typed inbound context and explicitly published host-only tool-result metadata.
- contextual
- Contextual tool authoring and JSON-argument dispatch adapters.
ToolContextcarries typed inbound values and host-only result metadata; model-visible outputs retain their text, JSON, or multimodal representation. - managed
- Registry contracts for refreshable external tool sources.
Generation tokens protect newer registrations from stale refreshes, while
DynamicTool::is_livereports disconnection without tool execution. - portable
- Context-free tool authoring contracts.
Structs§
- Tool
Execution Error - One public envelope for every tool execution failure.
- Tool
Output - The canonical model-visible output produced by a tool.
- Tool
Result - The single structured execution view used by dispatch, hooks, and telemetry.
Enums§
- Tool
Error Kind - Normalized classification for a tool execution error.
Traits§
- Into
Tool Output - Conversion into Rig’s canonical tool output.