pub trait DynTool: Send + Sync {
// Required methods
fn kind(&self) -> ToolKind;
fn description(&self) -> &str;
fn parameters_schema(&self) -> Value;
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCtx,
raw_args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolRunResult, ToolError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn input_format(&self) -> ToolInputFormat { ... }
}Expand description
The object-safe, type-erased tool the registry stores.
Every typed Tool becomes one of these via the internal TypedTool adapter.
It is also the seam for dynamically described tools with no compile-time
Args type — MCP tools implement DynTool directly (schema fetched from the
server, kind = ToolKind::Other) and register via
Registry::register_dyn.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
The description offered to the model.
Sourcefn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
The JSON Schema for this tool’s arguments.
Sourcefn call<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCtx,
raw_args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolRunResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCtx,
raw_args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolRunResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Decode raw JSON args, run, and re-serialize into both result faces.
§Errors
ToolError::Respond for bad args or any recoverable failure;
ToolError::Fatal when the transcript is unrecoverable.
Provided Methods§
Sourcefn input_format(&self) -> ToolInputFormat
fn input_format(&self) -> ToolInputFormat
How the tool’s input is specified to the model (ADR-0003 amendment
2026-07-19). Defaults to the derived JSON schema; a freeform tool
(raw-text args constrained by a grammar, e.g. codex apply_patch)
overrides this — and still rides the one dispatch door with
Value::String args.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".