pub struct ToolRegistry { /* private fields */ }Expand description
Tool registry for managing all available tools
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register_builtin(&self, tool: Arc<dyn Tool>)
pub fn register_builtin(&self, tool: Arc<dyn Tool>)
Register a builtin tool (cannot be overridden by dynamic tools)
Sourcepub fn register(&self, tool: Arc<dyn Tool>)
pub fn register(&self, tool: Arc<dyn Tool>)
Register a tool
If a tool with the same name already exists as a builtin, the registration is rejected to prevent shadowing of core tools.
Sourcepub fn unregister(&self, name: &str) -> bool
pub fn unregister(&self, name: &str) -> bool
Unregister a tool by name
Returns true if the tool was found and removed.
Sourcepub fn definitions(&self) -> Vec<ToolDefinition>
pub fn definitions(&self) -> Vec<ToolDefinition>
Get all tool definitions for LLM
Sourcepub fn context(&self) -> ToolContext
pub fn context(&self) -> ToolContext
Get the tool context
Sourcepub fn set_search_config(&self, config: SearchConfig)
pub fn set_search_config(&self, config: SearchConfig)
Set the search configuration for the tool context
Sourcepub fn set_sandbox(&self, sandbox: Arc<dyn BashSandbox>)
pub fn set_sandbox(&self, sandbox: Arc<dyn BashSandbox>)
Set a sandbox executor so that bash tool calls use the sandbox even
when executed without an explicit ToolContext (i.e., via execute()).
Sourcepub async fn execute(&self, name: &str, args: &Value) -> Result<ToolResult>
pub async fn execute(&self, name: &str, args: &Value) -> Result<ToolResult>
Execute a tool by name using the registry’s default context
Sourcepub async fn execute_with_context(
&self,
name: &str,
args: &Value,
ctx: &ToolContext,
) -> Result<ToolResult>
pub async fn execute_with_context( &self, name: &str, args: &Value, ctx: &ToolContext, ) -> Result<ToolResult>
Execute a tool by name with an external context
Sourcepub async fn execute_raw(
&self,
name: &str,
args: &Value,
) -> Result<Option<ToolOutput>>
pub async fn execute_raw( &self, name: &str, args: &Value, ) -> Result<Option<ToolOutput>>
Execute a tool and return raw output using the registry’s default context
Sourcepub async fn execute_raw_with_context(
&self,
name: &str,
args: &Value,
ctx: &ToolContext,
) -> Result<Option<ToolOutput>>
pub async fn execute_raw_with_context( &self, name: &str, args: &Value, ctx: &ToolContext, ) -> Result<Option<ToolOutput>>
Execute a tool and return raw output with an external context