pub trait SchemaTool: Send + Sync {
type Input: JsonSchema + DeserializeOwned + Send;
const NAME: &'static str;
const DESCRIPTION: &'static str;
const STRICT: bool = false;
// Required method
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
input: Self::Input,
context: &'life1 ExecutionContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn input_schema() -> Value { ... }
}Expand description
Schema-based tool trait with automatic JSON schema generation.
Provides a higher-level abstraction over Tool with typed inputs
and automatic schema derivation via schemars.
Required Associated Constants§
Provided Associated Constants§
Required Associated Types§
type Input: JsonSchema + DeserializeOwned + Send
Required Methods§
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
input: Self::Input,
context: &'life1 ExecutionContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn input_schema() -> Value
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.