Skip to main content

ToolRegistry

Defined in the Tools module.
Rust AI Agent SDK Registry for managing tools

Fields

NameTypeDescription
toolsHashMap<String-

Methods

new

fn new() -> Self
Create a new empty registry

register

fn register(&mut self, tool: impl Tool + 'static) -> ()
Register a tool Parameters:
NameType
toolimpl Tool + 'static

get

fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
Get a tool by name Parameters:
NameType
name&str

has

fn has(&self, name: &str) -> bool
Check if a tool exists Parameters:
NameType
name&str

list

fn list(&self) -> Vec<&str>
List all tool names

definitions

fn definitions(&self) -> Vec<ToolDefinition>
Get all tool definitions

execute

async fn execute(&self, name: &str, args: Value) -> Result<ToolResult>
Execute a tool by name Parameters:
NameType
name&str
argsValue

len

fn len(&self) -> usize
Get the number of registered tools

is_empty

fn is_empty(&self) -> bool
Check if the registry is empty