Skip to main content

McpNamespace

Trait McpNamespace 

Source
pub trait McpNamespace {
    // Required methods
    fn mcp_namespace_tools() -> Vec<Value>;
    fn mcp_namespace_tool_names() -> Vec<String>;
    fn mcp_namespace_call(
        &self,
        name: &str,
        args: Value,
    ) -> Result<Value, String>;
    fn mcp_namespace_call_async(
        &self,
        name: &str,
        args: Value,
    ) -> impl Future<Output = Result<Value, String>> + Send;
}
Expand description

Trait for types that can be mounted as MCP tool namespaces.

Implemented automatically by #[mcp] on an impl block. Allows nested composition: a parent MCP server can mount a child’s tools with a name prefix.

Required Methods§

Source

fn mcp_namespace_tools() -> Vec<Value>

Get tool definitions for this namespace.

Source

fn mcp_namespace_tool_names() -> Vec<String>

Get tool names for this namespace (without prefix).

Source

fn mcp_namespace_call(&self, name: &str, args: Value) -> Result<Value, String>

Call a tool by name (sync). Returns error for async-only methods.

Source

fn mcp_namespace_call_async( &self, name: &str, args: Value, ) -> impl Future<Output = Result<Value, String>> + Send

Call a tool by name (async).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§