pub struct ToolRegistry { /* private fields */ }Expand description
Registry of client-side tools available to the HTTP agent provider.
Converts registered tools to the OpenAI tools array format and routes
tool call execution to the correct tool implementation.
§Examples
use ironflow_core::providers::http::tools::ToolRegistry;
let registry = ToolRegistry::new();
// registry.register(my_tool);
let tools_json = registry.to_openai_tools();Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register(self, tool: impl Tool + 'static) -> Self
pub fn register(self, tool: impl Tool + 'static) -> Self
Register a tool. Panics if a tool with the same name is already registered.
§Panics
Panics if a tool with the same name already exists in the registry.
Sourcepub fn to_openai_tools(&self) -> Vec<Value>
pub fn to_openai_tools(&self) -> Vec<Value>
Convert all registered tools to the OpenAI tools array format.
Each tool is represented as:
{
"type": "function",
"function": {
"name": "tool_name",
"description": "tool description",
"parameters": { ... json schema ... }
}
}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Freeze for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin 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