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§
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>
Sourcefn check_thread_policy(&self, _policy: &ThreadPolicy) -> Result<()>
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.
Sourcefn 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,
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".