-
Couldn't load subscription status.
- Fork 257
Add the --tool option to start Azure MCP server with a list of specific tools #685
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
Conversation
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 a new --tool command-line option to the Azure MCP server that allows users to specify a specific set of tools to expose, providing fine-grained control over which tools are available at runtime.
Key changes:
- Added
--tooloption that accepts multiple tool names and filters available tools - Implemented case-insensitive tool filtering in both listing and execution
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServiceStartCommandTests.cs | Added unit tests for the new --tool option parsing and binding |
| CommandFactoryToolLoaderTests.cs | Added comprehensive tests for tool filtering functionality including case-insensitive matching |
| CommandFactoryHelpers.cs | Extended test helper to include all available tool setups for comprehensive testing |
| ServiceStartOptions.cs | Added Tool property to store the filtered tool names |
| ServiceOptionDefinitions.cs | Defined the command-line option for --tool with proper configuration |
| ToolLoaderOptions.cs | Extended the record to include the Tool parameter for filtering |
| CommandFactoryToolLoader.cs | Implemented tool filtering logic in both list and call handlers |
| ServiceStartCommand.cs | Registered and bound the new --tool option |
| ServiceCollectionExtensions.cs | Passed the tool filter configuration to the tool loader options |
core/Azure.Mcp.Core/src/Areas/Server/Commands/ServiceCollectionExtensions.cs
Show resolved
Hide resolved
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.
Files that need to be updated:
- /servers/Azure.Mcp.Server/CHANGELOG.md
- /servers/Azure.Mcp/Server/TROUBLESHOOTING.md#can-i-select-what-tools-to-load-in-the-mcp-server
- /servers/Azure.Mcp.Server/TROUBLESHOOTING.md#tool-limitations
- /CONTRIBUTING.md#server-modes
- /CONTRIBUTING.md#server-discovery-and-namespace-filtering
In general, grep for namespace and you'll find MANY places to update to document this new server mode:
|
@joshfree I've updated the necessary docs. Please take a look. |
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.
Left a couple of nit suggestions
core/Azure.Mcp.Core/src/Areas/Server/Options/ServiceOptionDefinitions.cs
Outdated
Show resolved
Hide resolved
…nitions.cs Co-authored-by: Jonathan Cárdenas <[email protected]>
Co-authored-by: Jonathan Cárdenas <[email protected]>
|
There's some CI failures to look at |
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.
Right now the --tool params only work when --mode all is set. Without mode all the routing through namespaces is not working as expected.
The design feels awkward when --mode all is not set since as a user if I passed in an allow list of tools I actually don't get those tool names listed - i get the namespaces that they are in.
IMO - If --tool are individually specified I would expect the server to automatically switch into all mode but this could also lead to developer confusion.
I would expect that MCP hosts / consumers could automatically filter lists of tools to provide to sub agents for these types of scenarios.
What does this PR do?
Add "--tool " switch for fine grained control over tool list. The
--namespaceand--tooloptions cannot be used together. Use multiple--toolparameters to include multiple tools. Using--toolautomatically switches toallmode.GitHub issue number?
#565
Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentation/docs/azmcp-commands.mdand/or/docs/fabric-commands.mdToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test prompts/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline