pub struct ToolCollection { /* private fields */ }Expand description
Collection of tools with built-in validation and lookup capabilities
This struct encapsulates all tool management logic in the library layer, providing a clean API for the binary to delegate tool operations to.
Implementations§
Source§impl ToolCollection
impl ToolCollection
Sourcepub fn from_tools(tools: Vec<Tool>) -> Self
pub fn from_tools(tools: Vec<Tool>) -> Self
Create a tool collection from a vector of tools
Sourcepub fn get_tool_names(&self) -> Vec<String>
pub fn get_tool_names(&self) -> Vec<String>
Get all tool names
Sourcepub fn to_mcp_tools(&self) -> Vec<McpTool>
pub fn to_mcp_tools(&self) -> Vec<McpTool>
Convert all tools to MCP Tool format for list_tools response
Sourcepub async fn call_tool(
&self,
tool_name: &str,
arguments: &Value,
) -> Result<CallToolResult, ToolCallError>
pub async fn call_tool( &self, tool_name: &str, arguments: &Value, ) -> Result<CallToolResult, ToolCallError>
Call a tool by name with validation
This method encapsulates all tool validation logic:
- Tool not found errors with suggestions
- Parameter validation
- Tool execution
Trait Implementations§
Source§impl Clone for ToolCollection
impl Clone for ToolCollection
Source§fn clone(&self) -> ToolCollection
fn clone(&self) -> ToolCollection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ToolCollection
impl Default for ToolCollection
Source§fn default() -> ToolCollection
fn default() -> ToolCollection
Returns the “default value” for a type. Read more
Source§impl<'a> IntoIterator for &'a ToolCollection
impl<'a> IntoIterator for &'a ToolCollection
Auto Trait Implementations§
impl Freeze for ToolCollection
impl !RefUnwindSafe for ToolCollection
impl Send for ToolCollection
impl Sync for ToolCollection
impl Unpin for ToolCollection
impl !UnwindSafe for ToolCollection
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