pub trait DynamicToolSource: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn version(&self) -> u64 { ... }
fn invoke_with_store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
One external tool catalog. Implementors own their connection, their
naming (see the mcp_{server_id}_{tool} namespace convention in
causa-extension), and their change notifications.
Required Methods§
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The current tool listing. Fails when the catalog is unreachable — the executor then keeps serving the source’s last good listing (with a warning) and proceeds; a source with no cached listing yet is skipped. Either way the turn is not interrupted.
Sourcefn invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute one call against the catalog. call.tool_name arrives in
the source’s namespace; implementors de-namespace it (and reject
names outside their namespace). Sources return the recorded result
only — what an UnknownOutcome result does next is harness
configuration, not source vocabulary.
Provided Methods§
Sourcefn version(&self) -> u64
fn version(&self) -> u64
Change signal for executor-side caching: bump whenever the tool
listing may have changed (e.g. MCP tools/list_changed). The
executor caches the listing keyed by this value — a source whose
observed version matches the cache costs no re-list, and a source
without change notifications (the 0 default) is therefore listed
once and served from the cache until it bumps.
Sourcefn invoke_with_store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn invoke_with_store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
call: &'life1 ToolCallPayload,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = Result<ToolResultPayload, ToolExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute one call with the host’s artifact store available for
media ingest: a source whose tools produce images can persist the
bytes via store and attach crate::context::block::MediaRefs
to the result’s ToolResultPayload.media instead of degrading
them to text. Additive with a delegating default, so sources that
never produce media keep their existing invoke only.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".