MCP: Validate tool name uniqueness across BuiltIn and Custom tools#3110
Merged
souvikghosh04 merged 7 commits intomainfrom Feb 11, 2026
Merged
MCP: Validate tool name uniqueness across BuiltIn and Custom tools#3110souvikghosh04 merged 7 commits intomainfrom
souvikghosh04 merged 7 commits intomainfrom
Conversation
Co-authored-by: souvikghosh04 <[email protected]>
Co-authored-by: souvikghosh04 <[email protected]>
…st comments Co-authored-by: souvikghosh04 <[email protected]>
Copilot
AI
changed the title
[WIP] Handle duplicate tool names for MCP tools
MCP: Validate tool name uniqueness across BuiltIn and Custom tools
Feb 6, 2026
Contributor
There was a problem hiding this comment.
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 |
anushakolan
requested changes
Feb 6, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Aniruddh25
reviewed
Feb 6, 2026
Aniruddh25
reviewed
Feb 6, 2026
Aniruddh25
reviewed
Feb 6, 2026
Aniruddh25
reviewed
Feb 6, 2026
Aniruddh25
reviewed
Feb 6, 2026
Aniruddh25
requested changes
Feb 6, 2026
Collaborator
Aniruddh25
left a comment
There was a problem hiding this comment.
Reducing the test matrix to what is really possible.
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Aniruddh25
approved these changes
Feb 11, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.