pub struct ToolHandle(/* private fields */);Expand description
Opaque handle wrapping a type-erased tool for dynamic registration.
Implementations§
Source§impl ToolHandle
impl ToolHandle
pub fn new<T: ErasedTool + 'static>(tool: T) -> Self
pub fn from_arc(tool: Arc<dyn ErasedTool>) -> Self
pub fn into_inner(self) -> Arc<dyn ErasedTool> ⓘ
pub fn inner(&self) -> &Arc<dyn ErasedTool> ⓘ
pub fn name(&self) -> &'static str
pub fn description(&self) -> &'static str
pub fn schema(&self) -> Schema
pub async fn erased_is_available( &self, ctx_request: &ContextRequest, compiled_context: &Value, ) -> Result<bool, String>
pub async fn erased_execute( &self, ctx_request: &ContextRequest, args: Value, ) -> Result<Value, String>
Trait Implementations§
Source§impl Clone for ToolHandle
impl Clone for ToolHandle
Source§fn clone(&self) -> ToolHandle
fn clone(&self) -> ToolHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolHandle
impl Debug for ToolHandle
Source§impl ErasedTool for ToolHandle
impl ErasedTool for ToolHandle
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Human/LLM-readable description explaining the tool’s capability.
Source§fn erased_is_available<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx_request: &'life1 ContextRequest,
compiled_context: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn erased_is_available<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx_request: &'life1 ContextRequest,
compiled_context: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Evaluated per turn to determine if tool is currently active/available.
Source§fn erased_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx_request: &'life1 ContextRequest,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn erased_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx_request: &'life1 ContextRequest,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes the tool with untyped JSON arguments and returns structured JSON output.
Auto Trait Implementations§
impl !RefUnwindSafe for ToolHandle
impl !UnwindSafe for ToolHandle
impl Freeze for ToolHandle
impl Send for ToolHandle
impl Sync for ToolHandle
impl Unpin for ToolHandle
impl UnsafeUnpin for ToolHandle
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