pub trait ToolClient:
Send
+ Sync
+ Debug {
// Required methods
fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 ToolId,
arguments: &'life2 Value,
provenance: Option<&'life3 Provenance>,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn destination(&self, tool: &ToolId) -> Destination;
}Expand description
Transports a tool call. Implemented by the MCP adapter, or by anything else.
Required Methods§
Sourcefn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 ToolId,
arguments: &'life2 Value,
provenance: Option<&'life3 Provenance>,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool: &'life1 ToolId,
arguments: &'life2 Value,
provenance: Option<&'life3 Provenance>,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Invoke a tool and return its result.
§Errors
A ToolError whose variant states what is known about whether the call
reached the far side. Getting that wrong is how a payment happens twice,
so an implementation that cannot tell must say ToolError::TimedOut.
provenance is what the callee may check: which run, which effect,
which agent, signed for exactly this call. A transport that has nowhere
to put it ignores it — that is a weaker deployment, not a broken one —
but it must never invent one, because a fabricated block is precisely
the compromised-intermediary case the signature exists to detect.
Sourcefn destination(&self, tool: &ToolId) -> Destination
fn destination(&self, tool: &ToolId) -> Destination
Where this client sends this call, for the plane’s egress allowlist.
Per tool rather than per client, because ToolRouter is itself a
ToolClient fanning out to one transport per server: a single answer
for the whole router would have to be the union of its routes, and a
union is exactly the wildcard Egress refuses to have.
No default, deliberately, for the reason
JournalStore::is_shared
has none: a default of Destination::Local would let a remote
transport answer reaches nobody by saying nothing, and the runtime
uses this answer to refuse a destination the deployment never granted —
and a control that fails open when an implementer forgets is not a
control.
Answered cheaply — it is read before every dispatch, so a client that resolved DNS here would put a lookup in the hot path.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".