Package org.springframework.ai.mcp
Interface McpToolNamePrefixGenerator
- All Known Implementing Classes:
DefaultMcpToolNamePrefixGenerator
public interface McpToolNamePrefixGenerator
Strategy interface for generating prefixed tool name based on MCP client/server and
Tool information.
Implementations of this interface can define custom logic to create meaningful and unique prefixes for tools, useful for avoiding name collisions in environments where multiple MCP Servers provide tools.
The prefix generation can take into account various aspects of the MCP client, server and tool, such as client capabilities, client information, and server initialization results, as well as specific attributes of the tool itself.
- Author:
- Christian Tzolov
-
Method Summary
Modifier and TypeMethodDescriptionstatic McpToolNamePrefixGenerator
noPrefix()
Static factory method to create a no-op prefix generator that returns the tool nameprefixedToolName
(McpConnectionInfo mcpConnectionInfo, io.modelcontextprotocol.spec.McpSchema.Tool tool)
-
Method Details
-
prefixedToolName
String prefixedToolName(McpConnectionInfo mcpConnectionInfo, io.modelcontextprotocol.spec.McpSchema.Tool tool) -
noPrefix
Static factory method to create a no-op prefix generator that returns the tool name- Returns:
- a prefix generator that returns the tool name as-is
-