pub struct ExtensionRunner { /* private fields */ }Expand description
Extension runner for executing extension-provided tools
Implementations§
Source§impl ExtensionRunner
impl ExtensionRunner
Sourcepub fn register_tool(&mut self, name: String, tool_fn: ToolFn)
pub fn register_tool(&mut self, name: String, tool_fn: ToolFn)
Register a tool function with a given name
Sourcepub fn execute_tool(
&self,
name: &str,
args: &[Value],
) -> Result<Value, ExtensionRunnerError>
pub fn execute_tool( &self, name: &str, args: &[Value], ) -> Result<Value, ExtensionRunnerError>
Execute a registered tool by name with the given arguments
Sourcepub fn list_tools(&self) -> Vec<String>
pub fn list_tools(&self) -> Vec<String>
Get list of registered tool names
Sourcepub fn on_tool_call(
&self,
tool_name: &str,
arguments: Value,
) -> Result<ToolCallResult, ExtensionRunnerError>
pub fn on_tool_call( &self, tool_name: &str, arguments: Value, ) -> Result<ToolCallResult, ExtensionRunnerError>
Handle a tool call event
This method processes a tool call request, executing the registered tool and returning the result. It provides a unified entry point for tool call handling from various sources (LLM responses, IPC, etc.)
§Arguments
tool_name- Name of the tool to callarguments- JSON arguments to pass to the tool
§Returns
Result containing the tool’s response or an error
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExtensionRunner
impl RefUnwindSafe for ExtensionRunner
impl Send for ExtensionRunner
impl Sync for ExtensionRunner
impl Unpin for ExtensionRunner
impl UnwindSafe for ExtensionRunner
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more