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
Fields
| Name | Type | Description |
|---|---|---|
tools | HashMap<String | – |
Methods
new
fn new() -> SelfCreate a new empty registry
register
fn register(&mut self, tool: impl Tool + 'static) -> ()Register a tool
Parameters:
| Name | Type |
|---|---|
tool | impl Tool + 'static |
get
fn get(&self, name: &str) -> Option<Arc<dyn Tool>>Get a tool by name
Parameters:
| Name | Type |
|---|---|
name | &str |
has
fn has(&self, name: &str) -> boolCheck if a tool exists
Parameters:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
name | &str |
args | Value |
len
fn len(&self) -> usizeGet the number of registered tools
is_empty
fn is_empty(&self) -> boolCheck if the registry is empty
Source
View on GitHubpraisonai/src/tools/mod.rs at line 101