-
Notifications
You must be signed in to change notification settings - Fork 304
MCP: Validate tool name uniqueness across BuiltIn and Custom tools #3110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: souvikghosh04 <210500244+souvikghosh04@users.noreply.github.com>
Co-authored-by: souvikghosh04 <210500244+souvikghosh04@users.noreply.github.com>
…st comments Co-authored-by: souvikghosh04 <210500244+souvikghosh04@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds validation to ensure MCP tool names are unique across both built-in and custom tool types. Without this validation, custom tools (generated from stored procedure entities) could conflict with built-in tools like create_record or read_records, causing undefined behavior during tool invocation.
Changes:
- Added duplicate tool name detection in
McpToolRegistry.RegisterTool()that throwsDataApiBuilderExceptionwhen a conflict is detected - Implemented comprehensive test suite with 12 test cases covering various duplicate scenarios, case sensitivity, and error messaging
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Azure.DataApiBuilder.Mcp/Core/McpToolRegistry.cs | Added validation logic to detect and reject duplicate tool names across BuiltIn and Custom tool types |
| src/Service.Tests/Mcp/McpToolRegistryTests.cs | New test file with comprehensive coverage of duplicate detection scenarios, case sensitivity, and edge cases |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Aniruddh25
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing the test matrix to what is really possible.
… copilot/handle-duplicate-tool-names
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
MCP tool names must be unique. Without validation, custom tools (generated from stored procedure entities) could conflict with built-in tools (
create_record,read_records, etc.) or other custom tools, causing undefined behavior during tool invocation.What is this change?
Added duplicate detection in
McpToolRegistry.RegisterTool()that throwsDataApiBuilderExceptionon conflict:Files Modified:
McpToolRegistry.cs: Added validation inRegisterTool()Files Added:
McpToolRegistryTests.cs: 12 test cases covering duplicate detection across tool types, case sensitivity, and error messagingValidation occurs during
McpToolRegistryInitializer.StartAsync()ensuring fail-fast at service startup.How was this tested?
Sample Request(s)
N/A - Internal validation, no user-facing API changes
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.