pub trait McpClient: Send + Sync {
// Required methods
fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<McpTool>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
arguments: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn call_tool_cancellable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
arguments: Value,
cancellation: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Minimal MCP client contract required by Code Mode.
Required Methods§
Provided Methods§
Sourcefn call_tool_cancellable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
arguments: Value,
cancellation: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn call_tool_cancellable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
arguments: Value,
cancellation: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Calls one remote MCP tool under an execution-scoped cancellation signal.
The default implementation races McpClient::call_tool against the
token. That returns control to Code Mode promptly, but it cannot stop
work the peer has already accepted. An implementation backed by a real
MCP transport should override this to also inform the peer, so a
cancelled pass does not leave a downstream request running.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".