Skip to main content

Tool

Trait Tool 

Source
pub trait Tool:
    Send
    + Sync
    + Debug {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn parameters_schema(&self) -> Value;
    fn execute(
        &self,
        parameters: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, AgentError>> + Send + '_>>;
}
Expand description

A tool that can be executed by the agent

Required Methods§

Source

fn name(&self) -> &'static str

The name of the tool (used in function calls)

Source

fn description(&self) -> &'static str

A description of what the tool does

Source

fn parameters_schema(&self) -> Value

JSON Schema for the tool’s parameters

Source

fn execute( &self, parameters: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, AgentError>> + Send + '_>>

Execute the tool with given parameters

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§