Skip to content

Conversation

@fanyang-mono
Copy link
Contributor

@fanyang-mono fanyang-mono commented Oct 2, 2025

What does this PR do?

Add "--tool " switch for fine grained control over tool list. The --namespace and --tool options cannot be used together. Use multiple --tool parameters to include multiple tools. Using --tool automatically switches to all mode.

GitHub issue number?

#565

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Updated command list in /docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copy link
Contributor

Copilot AI left a 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 --tool option 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

@jongio jongio requested a review from wbreza October 2, 2025 23:22
Copy link
Member

@joshfree joshfree left a 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:

  1. /servers/Azure.Mcp.Server/CHANGELOG.md
  2. /servers/Azure.Mcp/Server/TROUBLESHOOTING.md#can-i-select-what-tools-to-load-in-the-mcp-server
  3. /servers/Azure.Mcp.Server/TROUBLESHOOTING.md#tool-limitations
  4. /CONTRIBUTING.md#server-modes
  5. /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:

image

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure MCP Server Oct 3, 2025
@fanyang-mono
Copy link
Contributor Author

@joshfree I've updated the necessary docs. Please take a look.

Copy link
Member

@JonathanCrd JonathanCrd left a 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

@joshfree
Copy link
Member

joshfree commented Oct 7, 2025

There's some CI failures to look at

Copy link
Contributor

@wbreza wbreza left a 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.

@fanyang-mono fanyang-mono merged commit e4b07cb into microsoft:main Oct 8, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants