Skip to content

Enhance Advisor metadata list with Azure Resource Graph filters - #3197

Open
ravigupta99 wants to merge 8 commits into
microsoft:mainfrom
ravigupta99:guptaravi/advisor-metadata-tools
Open

Enhance Advisor metadata list with Azure Resource Graph filters#3197
ravigupta99 wants to merge 8 commits into
microsoft:mainfrom
ravigupta99:guptaravi/advisor-metadata-tools

Conversation

@ravigupta99

@ravigupta99 ravigupta99 commented Aug 3, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Renames advisor_recommendation-type_list to advisor_metadata_list and moves recommendation-type discovery from the ARM metadata endpoint to the global Azure Resource Graph catalog at microsoft.advisor/metadata.

The enhanced tool:

  • Returns richer localized recommendation metadata, actions, resource names, source queries, and service-retirement details.
  • Preserves greenfield catalog discovery and brownfield resource-type onboarding scenarios.
  • Supports language, resource type, impact, category, and subcategory filters.
  • Adds case-insensitive exact Service Health tracking-ID array-element filtering without assuming stored casing.
  • Adds service-retirement date filtering with eq, lt, le, gt, and ge.
  • Applies selective service-retirement predicates before tracking-ID searches and date conversions.
  • Uses source-generated System.Text.Json serialization for AOT compatibility.
  • Validates malformed ARG responses and rejects service-retirement filters combined with conflicting subcategories using actionable HTTP 400 responses.
  • Coexists with the separately merged advisor_metadata_get tool and shares its recommendation-metadata wire models, with each record defined in a separate file.

The metadata catalog is tenant-agnostic, and the tool exposes neither a subscription nor tenant parameter.

Relevant documentation:

Validation

  • dotnet build tools/Azure.Mcp.Tools.Advisor/src/Azure.Mcp.Tools.Advisor.csproj
  • dotnet test tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Azure.Mcp.Tools.Advisor.Tests.csproj — 215 passed
  • dotnet build servers/Azure.Mcp.Server/src/Azure.Mcp.Server.csproj
  • eng/scripts/Update-AzCommandsMetadata.ps1
  • eng/scripts/Process-PackageReadMe.ps1 -Command validate
  • eng/common/spelling/Invoke-Cspell.ps1
  • Changelog compiler dry run
  • Live ARG checks for case-insensitive exact tracking-ID array matching and retirement-date predicates
  • Live azmcp advisor metadata list --tracking-id qny1-hb8 smoke test returned status 200

ToolDescriptionEvaluator passed for all eight advisor_metadata_list prompts: the tool ranked #1 or #2 for every prompt, with confidence scores from 0.459677 to 0.596603. Live/recorded tests are not applicable for Azure Advisor. The recommendation metadata catalog is Microsoft-managed, tenant-agnostic, and cannot be provisioned through this repository's test-resource framework. The Advisor test project therefore has HasLiveTests=false; comprehensive command/query unit tests and manual live ARG smoke tests cover the behavior.

GitHub issue number?

No linked issue.

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
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • 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 running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • 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 tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • 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 command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

guptaravi_microsoft and others added 2 commits July 31, 2026 16:30
Move recommendation type discovery to the Advisor metadata command group and query the Azure Resource Graph metadata catalog.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 3, 2026 06:11
@ravigupta99
ravigupta99 requested review from a team as code owners August 3, 2026 06:11
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Human review recommended

It introduces a breaking tool rename and changes the discovery backend to Azure Resource Graph with new filter semantics, which warrants final human verification of end-to-end behavior and compatibility.

Pull request overview

This PR updates the Azure Advisor “metadata/recommendation type discovery” surface by renaming the tool to advisor_metadata_list and switching discovery from the ARM Advisor metadata endpoint to the tenant-global Azure Resource Graph advisorresources catalog (microsoft.advisor/metadata), enabling richer localized metadata and additional server-side filters.

Changes:

  • Replaced the old “recommendation-type list” command/tool with azmcp advisor metadata list, backed by an ARG query and new filter model (language, resource type, impact, category, subcategory, tracking ID, retirement date).
  • Added new wire + public models for recommendation metadata (including actions and service-retirement details) and updated source-generated JSON context for AOT-safe serialization.
  • Updated server docs/metadata to reflect the tool rename (consolidated tools mapping, command docs, e2e prompts, README snippets) and added a breaking-change changelog entry.
File summaries
File Description
tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorServiceTests.cs Removed legacy ARM-metadata-based service tests (recommendation type listing).
tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorMetadataServiceTests.cs Added unit tests for ARG metadata query construction and metadata projection/validation.
tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Recommendation/RecommendationTypeListCommandTests.cs Removed tests for the deleted recommendation-type list command.
tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Metadata/RecommendationMetadataListCommandTests.cs Added unit tests for the new metadata list command validation and result shaping.
tools/Azure.Mcp.Tools.Advisor/src/Services/Models/RecommendationMetadataData.cs Added ARG “row” wire model for microsoft.advisor/metadata results.
tools/Azure.Mcp.Tools.Advisor/src/Services/Models/RecommendationMetadataApiResponse.cs Removed the ARM metadata endpoint wire model.
tools/Azure.Mcp.Tools.Advisor/src/Services/IAdvisorService.cs Updated service contract to expose ListRecommendationMetadataAsync(...) returning ResourceQueryResults<RecommendationMetadata>.
tools/Azure.Mcp.Tools.Advisor/src/Services/AdvisorService.cs Implemented tenant-global ARG metadata query + filter composition and model conversion.
tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationTypeListOptions.cs Removed options for the deleted legacy command.
tools/Azure.Mcp.Tools.Advisor/src/Options/Metadata/RecommendationMetadataListOptions.cs Added options for azmcp advisor metadata list including service-retirement filters.
tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationType.cs Removed legacy recommendation-type model.
tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationServiceRetirement.cs Added service-retirement model surfaced by metadata results.
tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationMetadataFilters.cs Added a strongly-typed filter record for query composition.
tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationMetadataAction.cs Added action model for metadata results.
tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationMetadata.cs Added the new public metadata model returned by the tool.
tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationTypeListCommand.cs Removed the legacy command implementation.
tools/Azure.Mcp.Tools.Advisor/src/Commands/Metadata/RecommendationMetadataListCommand.cs Added the new command implementation with validation and normalization logic.
tools/Azure.Mcp.Tools.Advisor/src/Commands/AdvisorJsonContext.cs Updated source-gen JSON registrations to include new models and string serialization used for KQL-safe tracking-id filtering.
tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs Switched command registration from recommendation-type subgroup to the new metadata subgroup.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Updated consolidated tool name/description and mapped tool ID to advisor_metadata_list.
servers/Azure.Mcp.Server/README.md Updated example prompts to reflect metadata discovery and service-retirement scenarios.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Added prompts for advisor_metadata_list and removed prompts for the old tool.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Updated command reference from advisor recommendation-type list to advisor metadata list and documented new flags.
servers/Azure.Mcp.Server/changelog-entries/enhance-advisor-metadata-list.yaml Added breaking-change changelog entry describing the tool rename and behavior shift.
Review details
  • Files reviewed: 24/24 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@ravigupta99

Copy link
Copy Markdown
Member Author

@microsoft-github-policy-service agree company="Microsoft"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md Outdated
guptaravi_microsoft and others added 2 commits August 3, 2026 15:36
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread servers/Azure.Mcp.Server/docs/azmcp-commands.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@g2vinay g2vinay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

resolve pending comment, otherwise lgtm.

guptaravi_microsoft and others added 2 commits August 5, 2026 12:22
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ravigupta99

Copy link
Copy Markdown
Member Author

resolve pending comment, otherwise lgtm.

Resolved all the comments, Vinay. Please review.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants