Skip to content

Use NamespaceToolLoader for consolidated mode#1002

Merged
fanyang-mono merged 5 commits intomicrosoft:mainfrom
fanyang-mono:use_namespaceToolLoader
Oct 30, 2025
Merged

Use NamespaceToolLoader for consolidated mode#1002
fanyang-mono merged 5 commits intomicrosoft:mainfrom
fanyang-mono:use_namespaceToolLoader

Conversation

@fanyang-mono
Copy link
Copy Markdown
Contributor

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

What does this PR do?

This PR should resolve the following two issues:

  • Avoid mutating input commandFactory of ConsolidatedToolDiscoveryStrategy
  • Avoid spawning child processes per namespace, like how NamespaceToolLoader does

GitHub issue number?

Contributes to #849

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
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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 /servers/Azure.Mcp.Server/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

@joshfree joshfree added server-Azure.Mcp Azure.Mcp.Server tools-Core AZMCP Core functionality that all other tools build on top of labels Oct 29, 2025
@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Oct 29, 2025
@joshfree joshfree added this to the 2025-11 milestone Oct 29, 2025
@fanyang-mono fanyang-mono marked this pull request as ready for review October 29, 2025 19:17
@fanyang-mono fanyang-mono requested review from a team as code owners October 29, 2025 19:17
@fanyang-mono fanyang-mono changed the title [WIP] Use NamespaceToolLoader for consolidated mode Use NamespaceToolLoader for consolidated mode Oct 29, 2025
@fanyang-mono
Copy link
Copy Markdown
Contributor Author

@conniey @anuchandy I would like to hear your feedbacks on this PR.

Copy link
Copy Markdown
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 refactors the consolidated tool discovery mechanism to separate concerns and enable direct in-process execution of consolidated commands. The key changes decouple ConsolidatedToolDiscoveryStrategy from the responsibility of creating server providers, introducing a new method CreateConsolidatedCommandFactory() that builds a dedicated CommandFactory with consolidated command groups.

  • Refactored ConsolidatedToolDiscoveryStrategy to create a new CommandFactory instance for consolidated tools rather than mutating the original
  • Added NamespaceToolLoader instantiation in ConsolidatedProxy mode to enable direct in-process execution alongside proxy tools
  • Enhanced NamespaceToolLoader with an optional filter parameter to control namespace filtering behavior

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ConsolidatedToolDiscoveryStrategy.cs Refactored to extract command factory creation logic and return empty provider list from DiscoverServersAsync
ServiceCollectionExtensions.cs Added composite tool loader setup for ConsolidatedProxy mode combining server and namespace loaders
NamespaceToolLoader.cs Added optional applyFilter parameter to control filtering behavior and propagate tool metadata hints
ConsolidatedToolDiscoveryStrategyTests.cs Updated test expectations and added new tests for CreateConsolidatedCommandFactory method
launch.json Added new debug configuration for consolidated mode testing

@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Oct 30, 2025
@fanyang-mono fanyang-mono reopened this Oct 30, 2025
@github-project-automation github-project-automation Bot moved this from Done to Untriaged in Azure MCP Server Oct 30, 2025
@fanyang-mono fanyang-mono moved this from Untriaged to In Progress in Azure MCP Server Oct 30, 2025
Copy link
Copy Markdown
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.

Add a CHANGELOG entry please :)

@joshfree
Copy link
Copy Markdown
Member

LGTM - thanks Fan

@fanyang-mono fanyang-mono enabled auto-merge (squash) October 30, 2025 18:52
@fanyang-mono fanyang-mono merged commit 37c48fc into microsoft:main Oct 30, 2025
24 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Oct 30, 2025
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Dec 8, 2025
* Use NamespaceToolLoader for consolidated mode

* Add a switch to dynamically filterring for specific namespaces or not

* Add tests

* Update CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-Azure.Mcp Azure.Mcp.Server tools-Core AZMCP Core functionality that all other tools build on top of

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants