pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn tier(&self) -> Tier;
fn call<'a>(
&'a self,
args: ToolArgs,
ctx: &'a ToolCtx,
) -> BoxFut<'a, ToolResult>;
// Provided methods
fn approval_level(&self, _args: &ToolArgs, _ctx: &ToolCtx) -> ApprovalLevel { ... }
fn cancel_behavior(&self) -> CancelBehavior { ... }
fn description(&self) -> Option<&str> { ... }
fn input_schema(&self) -> Value { ... }
fn preview_call<'a>(
&'a self,
_args: &'a ToolArgs,
_ctx: &'a ToolCtx,
) -> BoxFut<'a, Option<String>> { ... }
}Required Methods§
fn name(&self) -> &str
fn tier(&self) -> Tier
fn call<'a>( &'a self, args: ToolArgs, ctx: &'a ToolCtx, ) -> BoxFut<'a, ToolResult>
Provided Methods§
fn approval_level(&self, _args: &ToolArgs, _ctx: &ToolCtx) -> ApprovalLevel
fn cancel_behavior(&self) -> CancelBehavior
fn description(&self) -> Option<&str>
fn input_schema(&self) -> Value
fn preview_call<'a>( &'a self, _args: &'a ToolArgs, _ctx: &'a ToolCtx, ) -> BoxFut<'a, Option<String>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".