Enhance Advisor metadata list with Azure Resource Graph filters - #3197
Enhance Advisor metadata list with Azure Resource Graph filters#3197ravigupta99 wants to merge 8 commits into
Conversation
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>
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 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.
|
@microsoft-github-policy-service agree company="Microsoft" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
g2vinay
left a comment
There was a problem hiding this comment.
resolve pending comment, otherwise lgtm.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolved all the comments, Vinay. Please review. |
What does this PR do?
Renames
advisor_recommendation-type_listtoadvisor_metadata_listand moves recommendation-type discovery from the ARM metadata endpoint to the global Azure Resource Graph catalog atmicrosoft.advisor/metadata.The enhanced tool:
eq,lt,le,gt, andge.System.Text.Jsonserialization for AOT compatibility.advisor_metadata_gettool 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.csprojdotnet test tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Azure.Mcp.Tools.Advisor.Tests.csproj— 215 passeddotnet build servers/Azure.Mcp.Server/src/Azure.Mcp.Server.csprojeng/scripts/Update-AzCommandsMetadata.ps1eng/scripts/Process-PackageReadMe.ps1 -Command validateeng/common/spelling/Invoke-Cspell.ps1azmcp advisor metadata list --tracking-id qny1-hb8smoke test returned status 200ToolDescriptionEvaluatorpassed for all eightadvisor_metadata_listprompts: the tool ranked #1 or #2 for every prompt, with confidence scores from0.459677to0.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 hasHasLiveTests=false; comprehensive command/query unit tests and manual live ARG smoke tests cover the behavior.GitHub issue number?
No linked issue.
Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.jsonbreaking-changelabelservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test PipelineInvoking Livetests
Copilot submitted PRs are not trustworthy by default. Users with
writeaccess 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.