Tool Registry • Rust AI Agent SDK

ToolRegistry: Registry for managing tools

ToolRegistry

Defined in the tools module.

Rust AI Agent SDK

Registry for managing tools

Diagram

uses

returns

Agent

Tool: ToolRegistry

Result

Fields

NameTypeDescription
toolsHashMap<String–

Methods

new

rust
fn new() -> Self

Create a new empty registry

register

rust
fn register(&mut self, tool: impl Tool + 'static) -> ()

Register a tool

Parameters:

NameType
toolimpl Tool + 'static

get

rust
fn get(&self, name: &str) -> Option<Arc<dyn Tool>>

Get a tool by name

Parameters:

NameType
name&str

has

rust
fn has(&self, name: &str) -> bool

Check if a tool exists

Parameters:

NameType
name&str

list

rust
fn list(&self) -> Vec<&str>

List all tool names

definitions

rust
fn definitions(&self) -> Vec<ToolDefinition>

Get all tool definitions

execute

rust
async fn execute(&self, name: &str, args: Value) -> Result<ToolResult>

Execute a tool by name

Parameters:

NameType
name&str
argsValue

len

rust
fn len(&self) -> usize

Get the number of registered tools

is_empty

rust
fn is_empty(&self) -> bool

Check if the registry is empty

Source

View on GitHub

praisonai/src/tools/mod.rs at line 101


Related Documentation