-
Notifications
You must be signed in to change notification settings - Fork 299
Implementation of Custom Tool in MCP #3048
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
Open
souvikghosh04
wants to merge
26
commits into
main
Choose a base branch
from
Usr/sogh/customtoolpoc-10dec2025
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
- Add EntityMcpOptions class with custom-tool and dml-tools properties - Add JSON converter supporting boolean and object formats - Add CLI support for --mcp.dml-tools and --mcp.custom-tool flags - Add schema validation restricting custom-tool to stored procedures - Entity.Mcp property is optional (default null) to avoid test cascade Only 9 files changed in this minimal implementation.
- Update EntityMcpOptions documentation to clarify custom-tool behavior in boolean mode - Replace if-else with switch-case in converter for better extensibility - Remove unnecessary null writes in serializer - Change CustomToolEnabled and DmlToolEnabled from nullable to non-nullable bool - Fix boolean shorthand deserialization to not mark custom-tool as user-provided - Add consistent else block in constructor for symmetry All 530 tests passing. Functionality verified with manual testing.
…/Azure/data-api-builder into Usr/sogh/entity-level-mcp-config
…/Azure/data-api-builder into Usr/sogh/entity-level-mcp-config
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
JerryNixon
requested changes
Jan 13, 2026
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Aniruddh25
reviewed
Jan 15, 2026
Aniruddh25
reviewed
Jan 15, 2026
Collaborator
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.
Posting comments so far. Still need to review tests/CustomMcpToolFactory.
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?
What is this change?
This pull request introduces a new system for dynamically generating and registering custom MCP tools based on stored procedure entity configurations in the runtime configuration. The main changes are the implementation of the
DynamicCustomToolclass, a factory to create these tools from configuration, and the necessary service registration logic to ensure these custom tools are available at runtime.Dynamic custom MCP tool support:
DynamicCustomToolclass, which implementsIMcpTooland provides logic for generating tool metadata, validating configuration, handling authorization, executing the underlying stored procedure, and formatting the response. This enables each stored procedure entity withcustom-toolenabled to be exposed as a dedicated MCP tool.CustomMcpToolFactoryclass, which scans the runtime configuration for stored procedure entities marked withcustom-toolenabled and creates correspondingDynamicCustomToolinstances.Dependency injection and service registration:
AddDabMcpServer) to register custom tools generated from configuration by calling a newRegisterCustomToolsmethod after auto-discovering static tools.RegisterAllMcpToolsmethod to excludeDynamicCustomToolfrom auto-discovery (since these are created dynamically per configuration) and added theRegisterCustomToolsmethod to register each generated custom tool as a singleton service.How was this tested?
Sample Request(s)
Error Scenarios
6. Missing Required Parameter
Edge Cases
9. SQL Injection Attempt