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 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
Auto Trait Implementations§
impl !Freeze for ToolRegistry
impl RefUnwindSafe for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
impl UnwindSafe for ToolRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more