Skip to main content

ToolHost

Trait ToolHost 

Source
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§

Source

fn name(&self) -> &str

Source

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.

Source

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.

Source§

fn name(&self) -> &str

Source§

fn provides(&self, tool: &str) -> bool

Source§

fn call(&mut self, invocation: &ToolInvocation) -> Result<Value, ToolError>

Implementors§