Skip to content

Conversation

@xiangyan99
Copy link
Member

What does this PR do?

[Provide a clear, concise description of the changes]

#833 refactor elicitation logic to share code.

[Any additional context, screenshots, or information that helps reviewers]

GitHub issue number?

[Link to the GitHub issue this PR addresses]

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

@xiangyan99 xiangyan99 marked this pull request as ready for review November 1, 2025 00:13
@xiangyan99 xiangyan99 requested review from a team as code owners November 1, 2025 00:13
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 refactors duplicate elicitation handling code by extracting the common secret elicitation logic from CommandFactoryToolLoader and NamespaceToolLoader into a shared BaseToolLoader.HandleSecretElicitationAsync method. This improves code maintainability by eliminating duplication.

  • Extracted duplicate elicitation logic into a new protected static method HandleSecretElicitationAsync in BaseToolLoader
  • Updated both tool loaders to inherit from BaseToolLoader and call the shared method
  • Standardized the disposal pattern by using DisposeAsyncCore instead of direct DisposeAsync implementation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
servers/Azure.Mcp.Server/CHANGELOG.md Documents the refactoring of duplicate elicitation handling code
core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/BaseToolLoader.cs Adds shared HandleSecretElicitationAsync method to centralize elicitation logic
core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/CommandFactoryToolLoader.cs Refactored to use shared elicitation method and proper disposal pattern
core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/NamespaceToolLoader.cs Refactored to use shared elicitation method

@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Nov 3, 2025
@joshfree joshfree added the tools-Core AZMCP Core functionality that all other tools build on top of label Nov 3, 2025
@joshfree joshfree added this to the 2025-11 milestone Nov 3, 2025
Copy link
Contributor

@fanyang-mono fanyang-mono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, LGTM!

@xiangyan99 xiangyan99 merged commit 6f86e68 into main Nov 7, 2025
26 checks passed
@xiangyan99 xiangyan99 deleted the eliciation_refactoring branch November 7, 2025 17:32
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants