Skip to main content

ToolSurface

Trait ToolSurface 

Source
pub trait ToolSurface: Send + Sync {
    // Required methods
    fn list_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<McpToolDefinition>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
        arguments: &'life2 Value,
    ) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

The caller’s tool surface, consulted per request.

Both halves are asked every time, deliberately. A caller whose visible set is fixed for a turn can answer from a Vec and pay nothing; a caller whose set depends on state that can change — a role, a quota, an interview in progress that must withhold a tool until it ends — can answer from that state at the moment the agent asks. Fixing the list at session open would make the second kind unrepresentable, and a gate that cannot be re-asked is a gate that silently stops applying.

Required Methods§

Source

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

Tools visible to this session right now.

Source

fn call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tool_name: &'life1 str, arguments: &'life2 Value, ) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run one call. A tool absent from list_tools is already refused by the host, so this is only reached for a tool the surface just advertised.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§