pub trait StaticTool:
Send
+ Sync
+ 'static {
type Params: DeserializeOwned + JsonSchema + Send;
type Output: Into<ToolResult> + Send;
type Spec: ToolSpec<Params = Self::Params, Result = Self::Output>;
const DESCRIPTION: &'static str;
const REQUIRES_APPROVAL: bool;
const REQUIRED_CAPABILITIES: Capabilities;
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: Self::Params,
ctx: &'life1 StaticToolContext,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, StaticToolError<<Self::Spec as ToolSpec>::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn schema() -> ToolSchema
where Self: Sized { ... }
}Required Associated Constants§
const DESCRIPTION: &'static str
const REQUIRES_APPROVAL: bool
const REQUIRED_CAPABILITIES: Capabilities
Required Associated Types§
type Params: DeserializeOwned + JsonSchema + Send
type Output: Into<ToolResult> + Send
type Spec: ToolSpec<Params = Self::Params, Result = Self::Output>
Required Methods§
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: Self::Params,
ctx: &'life1 StaticToolContext,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, StaticToolError<<Self::Spec as ToolSpec>::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn schema() -> ToolSchemawhere
Self: Sized,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.