-
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
base: main
Are you sure you want to change the base?
Conversation
- 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
|
/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.
Posting comments so far. Still need to review tests/CustomMcpToolFactory.
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.
Looks good overall, some confusion around what happens when a ConfigWithInvalidEntity is created.
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
anushakolan
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.
LGTM!
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
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.
Nullability of the config parameter type has inconsistent expectations.
Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
…/Azure/data-api-builder into Usr/sogh/customtoolpoc-10dec2025
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
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