Trait ToolBox

Source
pub trait ToolBox:
    Send
    + Sync
    + DynClone {
    // Required method
    fn available_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn name(&self) -> Cow<'_, str> { ... }
    fn boxed<'a>(self) -> Box<dyn ToolBox + 'a>
       where Self: Sized + 'a { ... }
}
Expand description

A toolbox is a collection of tools

It can be a list, an mcp client, or anything else we can think of.

This allows agents to not know their tools when they are created, and to get them at runtime.

It also allows for tools to be dynamically loaded and unloaded, etc.

Required Methods§

Source

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn name(&self) -> Cow<'_, str>

Source

fn boxed<'a>(self) -> Box<dyn ToolBox + 'a>
where Self: Sized + 'a,

Trait Implementations§

Source§

impl ToolBox for &dyn ToolBox

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn name(&self) -> Cow<'_, str>

Source§

fn boxed<'a>(self) -> Box<dyn ToolBox + 'a>
where Self: Sized + 'a,

Source§

impl ToolBox for Box<dyn ToolBox>

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn name(&self) -> Cow<'_, str>

Source§

fn boxed<'a>(self) -> Box<dyn ToolBox + 'a>
where Self: Sized + 'a,

Implementations on Foreign Types§

Source§

impl ToolBox for &[Box<dyn Tool>]

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl ToolBox for Box<dyn ToolBox>

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl ToolBox for Vec<Box<dyn Tool>>

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl ToolBox for [Box<dyn Tool>]

Source§

fn available_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§