pub struct ToolSet { /* private fields */ }Expand description
An ordered collection of tools.
Implementations§
Source§impl ToolSet
impl ToolSet
Sourcepub fn from_tools<T>(tools: Vec<T>) -> Selfwhere
T: Tool + 'static,
pub fn from_tools<T>(tools: Vec<T>) -> Selfwhere
T: Tool + 'static,
Build a set from homogeneous typed tools.
Sourcepub fn from_dynamic_tools(tools: Vec<DynamicTool>) -> Self
pub fn from_dynamic_tools(tools: Vec<DynamicTool>) -> Self
Build a set from runtime-defined tools.
Sourcepub fn builder() -> ToolSetBuilder
pub fn builder() -> ToolSetBuilder
Create a builder.
Sourcepub fn add_tool<T>(&mut self, tool: T) -> Stringwhere
T: Tool + 'static,
pub fn add_tool<T>(&mut self, tool: T) -> Stringwhere
T: Tool + 'static,
Register a typed tool.
Sourcepub fn add_dynamic_tool(&mut self, tool: DynamicTool) -> String
pub fn add_dynamic_tool(&mut self, tool: DynamicTool) -> String
Register a runtime-defined tool.
Sourcepub fn add_portable_dynamic_tool(&mut self, tool: PortableDynamicTool) -> String
pub fn add_portable_dynamic_tool(&mut self, tool: PortableDynamicTool) -> String
Register a context-free dynamic tool without rewriting its callback.
Sourcepub fn delete_tool(&mut self, name: &str)
pub fn delete_tool(&mut self, name: &str)
Delete a tool by name.
Sourcepub fn add_tools(&mut self, set: ToolSet)
pub fn add_tools(&mut self, set: ToolSet)
Merge another set, preserving registration order and replacing duplicates.
Sourcepub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
pub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
Provider-facing definitions in registration order.
Sourcepub async fn execute(
&self,
name: &str,
args: impl Into<String>,
context: &mut ToolContext,
) -> ToolResult
pub async fn execute( &self, name: &str, args: impl Into<String>, context: &mut ToolContext, ) -> ToolResult
Execute one registered tool through the canonical structured path.
The tool receives a snapshot of inbound context. Result metadata is
published back to context; mutations to inbound values are discarded.
Sourcepub fn schemas(&self) -> Result<Vec<ToolSchema>, EmbedError>
pub fn schemas(&self) -> Result<Vec<ToolSchema>, EmbedError>
Convert embedding tools to vector-store schemas.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ToolSet
impl !UnwindSafe for ToolSet
impl Freeze for ToolSet
impl Send for ToolSet
impl Sync for ToolSet
impl Unpin for ToolSet
impl UnsafeUnpin for ToolSet
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