Skip to main content

rig_core/tool/
mod.rs

1//! Tool authoring contracts, dispatch context, and canonical execution values.
2//! [`PortableTool`] provides context-free calls; [`Tool`] adds [`ToolContext`].
3//! Both can be adapted into [`ErasedTool`] handlers.
4//!
5//! ```
6//! use rig_core::tool::ToolOutput;
7//!
8//! let output = ToolOutput::json(serde_json::json!({"count": 3}));
9//! assert!(output.as_json().is_some());
10//! ```
11
12pub mod builtin;
13pub mod context;
14pub mod contextual;
15pub mod managed;
16mod output;
17pub mod portable;
18mod result;
19pub use context::{
20    ContextValue, PublishedContext, ToolContext, ToolContextError, ToolResultContext,
21};
22pub use contextual::{DynamicTool, ErasedTool, LivenessFn, Tool, ToolEmbedding, tool_definition};
23pub use managed::{ManagedToolSink, ManagedToolToken};
24pub use output::{IntoToolOutput, ToolOutput};
25pub use portable::{PortableTool, PortableToolEmbedding};
26pub use result::{ToolErrorKind, ToolExecutionError, ToolResult};