pub trait FunctionRegistry {
type Function;
type CallResult;
type Error: Error + Send + Sync + 'static;
// Required methods
fn register(&mut self, name: String, function: Self::Function) -> Result<()>;
fn call(&self, name: &str, args: &str) -> Result<Self::CallResult>;
fn list_functions(&self) -> Vec<String>;
fn has_function(&self, name: &str) -> bool;
}Expand description
Function calling abstraction for tool usage
§Synchronous Version
This trait provides synchronous operations for function calling.
Required Associated Types§
Sourcetype CallResult
type CallResult
The result type returned by function calls
Required Methods§
Sourcefn register(&mut self, name: String, function: Self::Function) -> Result<()>
fn register(&mut self, name: String, function: Self::Function) -> Result<()>
Register a new function
Sourcefn call(&self, name: &str, args: &str) -> Result<Self::CallResult>
fn call(&self, name: &str, args: &str) -> Result<Self::CallResult>
Call a function by name with arguments
Sourcefn list_functions(&self) -> Vec<String>
fn list_functions(&self) -> Vec<String>
List available functions
Sourcefn has_function(&self, name: &str) -> bool
fn has_function(&self, name: &str) -> bool
Check if a function exists