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::{
23    DynamicTool, ErasedTool, LivenessFn, Tool, ToolEmbedding, tool_definition, tool_name,
24};
25pub use managed::{ManagedToolSink, ManagedToolToken};
26pub use output::{IntoToolOutput, ToolOutput};
27pub use portable::{PortableTool, PortableToolEmbedding};
28pub use result::{ToolErrorKind, ToolExecutionError, ToolResult};