pub enum McpToolNamespace {
Default,
None,
Custom(Arc<dyn Fn(&McpServerId, &str) -> String + Send + Sync>),
}Expand description
Strategy used to derive the agentkit-side tool name for an MCP tool.
The default (Default) preserves agentkit’s historical
mcp_<server>_<tool> shape so that names satisfy provider validators
that only allow [a-zA-Z0-9_-] (e.g. Anthropic on Vertex). Use
McpToolNamespace::None when the calling provider already namespaces
remote tools, or McpToolNamespace::Custom for a bespoke scheme.
Variants§
Default
Format names as mcp_<server>_<tool>.
None
Use the raw MCP tool name with no prefix at all.
Custom(Arc<dyn Fn(&McpServerId, &str) -> String + Send + Sync>)
Apply a caller-supplied function for full control.
Implementations§
Source§impl McpToolNamespace
impl McpToolNamespace
Sourcepub fn custom(
f: impl Fn(&McpServerId, &str) -> String + Send + Sync + 'static,
) -> Self
pub fn custom( f: impl Fn(&McpServerId, &str) -> String + Send + Sync + 'static, ) -> Self
Builds a custom namespace from a closure.
Sourcepub fn apply(&self, server_id: &McpServerId, tool_name: &str) -> String
pub fn apply(&self, server_id: &McpServerId, tool_name: &str) -> String
Applies the namespace strategy to produce the agentkit tool name.
Sourcepub fn unapply(
&self,
server_id: &McpServerId,
agentkit_name: &str,
) -> Option<String>
pub fn unapply( &self, server_id: &McpServerId, agentkit_name: &str, ) -> Option<String>
Recovers the raw MCP tool name from an agentkit-side name. Returns
None for Self::Custom (no general inverse) or when the name
doesn’t match the expected shape.
Trait Implementations§
Source§impl Clone for McpToolNamespace
impl Clone for McpToolNamespace
Source§fn clone(&self) -> McpToolNamespace
fn clone(&self) -> McpToolNamespace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more