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 unregister_by_prefix(&self, prefix: &str)
pub fn unregister_by_prefix(&self, prefix: &str)
Unregister all tools whose names start with the given prefix.
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_agentic_search_config(&self, config: AgenticSearchConfig)
pub fn set_agentic_search_config(&self, config: AgenticSearchConfig)
Set the built-in agentic_search configuration for the default tool context.
Sourcepub fn set_agentic_parse_config(&self, config: AgenticParseConfig)
pub fn set_agentic_parse_config(&self, config: AgenticParseConfig)
Set the built-in agentic_parse configuration for the default tool context.
Sourcepub fn set_document_parser_config(&self, config: DocumentParserConfig)
pub fn set_document_parser_config(&self, config: DocumentParserConfig)
Set the built-in document context extraction configuration for the default tool context.
Sourcepub fn set_document_parsers(&self, registry: Arc<DocumentParserRegistry>)
pub fn set_document_parsers(&self, registry: Arc<DocumentParserRegistry>)
Set the document parser registry for the default 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
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more