Skip to main content

McpRegistryExt

Trait McpRegistryExt 

Source
pub trait McpRegistryExt {
    // Required methods
    fn register_mcp_service<S: McpService + 'static>(
        &mut self,
        service: &Arc<S>,
    ) -> impl Future<Output = Result<usize, McpError>> + Send;
    fn register_mcp_tools_by_name<S: McpService + 'static>(
        &mut self,
        service: &Arc<S>,
        tool_names: &[&str],
    ) -> impl Future<Output = Result<usize, McpError>> + Send;
}
Expand description

Extension trait for registering MCP services with a ToolRegistry.

Required Methods§

Source

fn register_mcp_service<S: McpService + 'static>( &mut self, service: &Arc<S>, ) -> impl Future<Output = Result<usize, McpError>> + Send

Registers all tools from an MCP service.

Discovers tools from the service and registers each one as a ToolHandler that delegates execution to the service.

§Returns

The number of tools registered.

Source

fn register_mcp_tools_by_name<S: McpService + 'static>( &mut self, service: &Arc<S>, tool_names: &[&str], ) -> impl Future<Output = Result<usize, McpError>> + Send

Registers specific tools from an MCP service by name.

Only registers tools whose names are in the provided list. Tools not found on the server are silently skipped.

§Returns

The number of tools actually registered.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§