feat: add duplicate tool name validation for MCP server registration
- Add AssertNotDupplicateTool validation method to prevent duplicate tool registration
- Throw IllegalArgumentException during server building when duplicate tool names detected
- Throw McpError when attempting to add duplicate tools to existing server
- Add test coverage for duplicate detection scenarios:
- Individual tool registration during building
- Batch tool registration (list and varargs)
- Runtime duplicate tool addition
- Apply validation to both sync and async server implementations
This prevents tool name conflicts that could cause unexpected behavior
or runtime errors in MCP server implementations.
Signed-off-by:
Christian Tzolov <christian.tzolov@broadcom.com>
Loading
Please sign in to comment