Skip to main content

McpExec

Trait McpExec 

Source
pub trait McpExec: Send + Sync {
    // Required methods
    fn list_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Tool>, ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call_tool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        arguments: Value,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = CallOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reconnect<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Minimum surface a plan needs from an MCP client.

All methods take &self so plans can drive concurrent calls (torture-style) and recover from faults via reconnect without ever holding an exclusive borrow. Phase E1 made this possible by moving the production Client behind an internal Arc<RwLock<...>>.

Required Methods§

Source

fn list_tools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Tool>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists every tool exposed by the server.

Source

fn call_tool<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, arguments: Value, timeout: Duration, ) -> Pin<Box<dyn Future<Output = CallOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calls a tool, applying timeout. Returns a CallOutcome that the caller pattern-matches; this method itself never errors.

Source

fn reconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Tears down the transport and rebuilds it. Used after a hang/crash so subsequent calls can succeed. Concurrent callers see either the old or the new transport, never a torn state.

Implementors§