pub trait ToolHost {
// Required methods
fn name(&self) -> &str;
fn provides(&self, tool: &str) -> bool;
fn call(&mut self, invocation: &ToolInvocation) -> Result<Value, ToolError>;
}Expand description
Something that can execute a tool call.
Required Methods§
fn name(&self) -> &str
Sourcefn provides(&self, tool: &str) -> bool
fn provides(&self, tool: &str) -> bool
Whether this host can serve tool, checked before the call is attempted
so that a missing tool is reported before any effect happens.
fn call(&mut self, invocation: &ToolInvocation) -> Result<Value, ToolError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<H: ToolHost + ?Sized> ToolHost for Box<H>
Lets a boxed host be used wherever a host is expected — including as the
inner host of a crate::RecordingTools, which is how the CLI wraps a
recorder around a host it chose at runtime. The same courtesy
crate::ModelProvider already gets.
impl<H: ToolHost + ?Sized> ToolHost for Box<H>
Lets a boxed host be used wherever a host is expected — including as the
inner host of a crate::RecordingTools, which is how the CLI wraps a
recorder around a host it chose at runtime. The same courtesy
crate::ModelProvider already gets.