Skip to main content

FunctionRegistry

Trait FunctionRegistry 

Source
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§

Source

type Function

The function type this registry handles

Source

type CallResult

The result type returned by function calls

Source

type Error: Error + Send + Sync + 'static

The error type returned by function operations

Required Methods§

Source

fn register(&mut self, name: String, function: Self::Function) -> Result<()>

Register a new function

Source

fn call(&self, name: &str, args: &str) -> Result<Self::CallResult>

Call a function by name with arguments

Source

fn list_functions(&self) -> Vec<String>

List available functions

Source

fn has_function(&self, name: &str) -> bool

Check if a function exists

Implementors§