Skip to main content

NativeTool

Trait NativeTool 

Source
pub trait NativeTool:
    Send
    + Sync
    + Debug {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn schema(&self) -> Value;
    fn call<'life0, 'async_trait>(
        &'life0 self,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn effect(&self) -> ToolEffect { ... }
    fn approval_class(&self) -> ApprovalClass { ... }
    fn sandbox_required(&self) -> bool { ... }
    fn concurrency_key(&self) -> Option<&str> { ... }
    fn exposure(&self) -> Exposure { ... }
    fn output_limit(&self) -> Option<TruncationPolicy> { ... }
    fn check_thread_policy(&self, _policy: &ThreadPolicy) -> Result<()> { ... }
    fn call_with_context<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: Value,
        _context: &'life1 NativeExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn schema(&self) -> Value

Source

fn call<'life0, 'async_trait>( &'life0 self, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn effect(&self) -> ToolEffect

Source

fn approval_class(&self) -> ApprovalClass

Source

fn sandbox_required(&self) -> bool

Source

fn concurrency_key(&self) -> Option<&str>

Source

fn exposure(&self) -> Exposure

Source

fn output_limit(&self) -> Option<TruncationPolicy>

Source

fn check_thread_policy(&self, _policy: &ThreadPolicy) -> Result<()>

Admit this captured in-process implementation for a delegated turn. Unknown implementations must not inherit unrestricted ambient access.

Source

fn call_with_context<'life0, 'life1, 'async_trait>( &'life0 self, args: Value, _context: &'life1 NativeExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Context is supplied by the host after schema validation and governance, never deserialized from model arguments. Legacy host calls are unchanged.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§