Repository navigation
Improve Advisor recommendation summaries - #3520
Merged
Vinay Gera (g2vinay) merged 23 commits intoSep 8, 2026
Merged
Vinay Gera (g2vinay) merged 23 commits into
Vinay Gera (g2vinay) merged 23 commits into
Conversation
…ecommendation-patch
…ecommendation-patch
…ecommendation-patch # Conflicts: # servers/Azure.Mcp.Server/docs/azmcp-commands.md # servers/Azure.Mcp.Server/docs/e2eTestPrompts.md # tools/Azure.Mcp.Tools.Advisor/src/Commands/AdvisorJsonContext.cs # tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationListCommand.cs # tools/Azure.Mcp.Tools.Advisor/src/Services/AdvisorService.cs # tools/Azure.Mcp.Tools.Advisor/src/Services/Models/RecommendationDescription.cs # tools/Azure.Mcp.Tools.Advisor/src/Services/Models/RecommendationProperties.cs # tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Recommendation/RecommendationListCommandTests.cs # tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorServiceConversionTests.cs
…r-recommendation-summary # Conflicts: # servers/Azure.Mcp.Server/docs/azmcp-commands.md # tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationListCommand.cs # tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationListOptions.cs # tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationSummaryOptions.cs # tools/Azure.Mcp.Tools.Advisor/src/Services/AdvisorService.cs # tools/Azure.Mcp.Tools.Advisor/src/Validation/RecommendationFilterValidator.cs # tools/Azure.Mcp.Tools.Advisor/src/Validation/ServiceRetirementFilterValidator.cs # tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorServiceFilterBuilderTests.cs
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
…ecommendation-summary # Conflicts: # servers/Azure.Mcp.Server/README.md # servers/Azure.Mcp.Server/docs/azmcp-commands.md # servers/Azure.Mcp.Server/docs/e2eTestPrompts.md # servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json # tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs # tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationListCommand.cs
Ravi Gupta (ravigupta99)
marked this pull request as ready for review
September 3, 2026 17:31
Ravi Gupta (ravigupta99)
requested review from
KarishmaGhiya,
Sai Koumudi Kaluvakolanu (saikoumudi),
Tom Meschter (tmeschter) and
Jeff Fisher (xirzec)
and
a lite review from Copilot
September 3, 2026 17:31
Ravi Gupta (ravigupta99)
requested review from
Jair Myree (jairmyree),
msalaman and
Sandeep Sen (sandeep-sen)
September 3, 2026 17:31
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are comprehensive, internally consistent across command/service/validation/docs, and the updated/added unit tests substantively cover the new query-building and summary-shaping behavior.
Pull request overview
This PR upgrades the advisor_recommendation_summary tool to produce canonical, metadata-backed aggregation results across additional grouping dimensions (including lifecycle status, metadata subcategory, and service-retirement date), while tightening validation and aligning summary/list filtering semantics via shared query-building utilities.
Changes:
- Added a dedicated
RecommendationSummaryServicethat builds current-engine-safe ARG queries and returns{ key, label, count }buckets with stable recommendation type IDs and English metadata labels. - Centralized and hardened KQL predicate construction (including current-engine filtering) via
RecommendationQueryBuilder, and expanded/normalized validation for filters and--top. - Updated command surface + docs/prompts/changelog and expanded tests to cover the new grouping/filtering behavior.
File summaries
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/RecommendationSummaryServiceTests.cs | Adds coverage for summary query composition, parsing/sorting, truncation handling, and retirement filter validation. |
| tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/RecommendationQueryBuilderTests.cs | Adds coverage for shared instance predicate construction and KQL sanitization semantics. |
| tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorServiceSummarizeQueryTests.cs | Removes legacy summarize-query tests replaced by the new summary service. |
| tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Services/AdvisorServiceFilterBuilderTests.cs | Removes legacy filter-builder tests replaced by RecommendationQueryBuilder. |
| tools/Azure.Mcp.Tools.Advisor/tests/Azure.Mcp.Tools.Advisor.Tests/Recommendation/RecommendationSummaryCommandTests.cs | Updates command tests for new groupings, validations, normalized filters, payload shape, and top/Unknown behavior. |
| tools/Azure.Mcp.Tools.Advisor/src/Validation/ServiceRetirementFilterValidator.cs | Extends shared retirement validation to support summary grouping and stricter empty/format checks. |
| tools/Azure.Mcp.Tools.Advisor/src/Validation/RecommendationFilterValidator.cs | Extracts shared validation/normalization helpers for summary + list. |
| tools/Azure.Mcp.Tools.Advisor/src/Services/RecommendationSummaryService.cs | Implements metadata-backed summary querying, grouping, and payload parsing. |
| tools/Azure.Mcp.Tools.Advisor/src/Services/RecommendationQueryBuilder.cs | Introduces shared, injection-resistant KQL predicate construction and current-engine restrictions. |
| tools/Azure.Mcp.Tools.Advisor/src/Services/IRecommendationSummaryService.cs | Adds a dedicated summary service contract. |
| tools/Azure.Mcp.Tools.Advisor/src/Services/IAdvisorService.cs | Removes the summary API from the main advisor service contract. |
| tools/Azure.Mcp.Tools.Advisor/src/Services/AdvisorService.cs | Switches list filtering to the shared predicate builder and removes the legacy summary implementation. |
| tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationSummaryOptions.cs | Expands summary options with new filters and clarifies semantics/limits. |
| tools/Azure.Mcp.Tools.Advisor/src/Options/Recommendation/RecommendationListOptions.cs | Clarifies list --top semantics now that summary has its own cap. |
| tools/Azure.Mcp.Tools.Advisor/src/Models/RecommendationGroup.cs | Expands group model to include label alongside key and count. |
| tools/Azure.Mcp.Tools.Advisor/src/Commands/Recommendation/RecommendationSummaryCommand.cs | Updates command DI + validation + normalization + error handling and top/Unknown slicing behavior. |
| tools/Azure.Mcp.Tools.Advisor/src/AdvisorSetup.cs | Registers the new summary service and updates group description text. |
| tools/Azure.Mcp.Tools.Advisor/cspell.yaml | Adds leftouter to support KQL test strings. |
| servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json | Refreshes the public tool description to reflect new summary capabilities and constraints. |
| servers/Azure.Mcp.Server/README.md | Adds example prompts and updates the Advisor service listing text. |
| servers/Azure.Mcp.Server/docs/e2eTestPrompts.md | Expands realistic evaluator prompts for the updated summary tool. |
| servers/Azure.Mcp.Server/docs/azmcp-commands.md | Updates CLI docs for the expanded summary command surface and semantics. |
| servers/Azure.Mcp.Server/changelog-entries/guptaravi-advisor-recommendation-summary.yml | Adds a schema-shaped changelog entry for the feature + fixes. |
Review details
- Files reviewed: 24/24 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ankiga-MSFT
reviewed
Sep 4, 2026
Vinay Gera (g2vinay)
approved these changes
Sep 8, 2026
17 of 19 tasks
KarishmaGhiya
added a commit
to KarishmaGhiya/mcp
that referenced
this pull request
Sep 9, 2026
Resolve conflict in RecommendationSummaryCommand by taking the rewritten description from microsoft#3520 and re-applying the OperationPlane annotation. Classify the four new drill run commands from microsoft#3379 as Control; they act on Microsoft.AzureResilienceManagement drill run resources through ARM, matching the other 36 commands in that toolset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41786790-3c42-4f91-aa52-7f81907feea0
17 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Improves
advisor_recommendation_summaryso aggregate Advisor questions return canonical, complete, and correctly grouped recommendation counts.This PR:
{ key, label, count }, using recommendation type IDs with English metadata labels;properties.impactedFieldfor resource-type filtering/grouping, with resource-ID extraction only as a grouping fallback;Newrecommendations by default while status grouping includes all lifecycle states;--topas 1-100 while preserving the full total and a trailingUnknownbucket;strlen(name) == 64andisempty(properties.serviceGroupId);Breaking change and migration
For
--group-by recommendation-type,groups[].keychanges from recommendation problem text to the recommendation type ID GUID.groups[].labelcontains the friendly metadata display name. Callers that used problem-text keys must migrate to the GUID key and uselabelfor presentation.Retirement-date semantics
Retirement comparisons are one-sided.
le:<end-date>includes all active recommendations retiring on or before the end date, including overdue retirements; it is not a bounded next-N window. The tool description and prompts now use explicit exact, on-or-before, and on-or-after semantics.Recommendation-list hardening
This PR also changes the shared query predicates used by
advisor_recommendation_list:strlen(name) == 64excludes legacy non-64-character recommendation IDs to prevent duplicate old-engine and new-engine recommendation instances;isempty(properties.serviceGroupId)reserves the future service-group recommendation flavor.Current live list results are unchanged: every observed record in the supported New, Completed, Dismissed, and Postponed states has a 64-character current-engine ID, all 1,005 legacy records have no supported list status, and no current records have a nonempty
serviceGroupId. The legacy names are 36 characters in the current live data.Dependency
PRs #3303 and #3307 are merged. This branch has been synchronized with the resulting
main.GitHub issue number?
Enhancement to the existing Advisor recommendation summary tool; no new onboarding issue was created.
Validation
dotnet test tools\Azure.Mcp.Tools.Advisor\tests\Azure.Mcp.Tools.Advisor.Tests\Azure.Mcp.Tools.Advisor.Tests.csprojdotnet build servers\Azure.Mcp.Server\src\Azure.Mcp.Server.csprojdotnet format Microsoft.Mcp.slnx --verify-no-changes --include "tools\Azure.Mcp.Tools.Advisor\**\*.cs".\eng\common\spelling\Invoke-Cspell.ps1.\eng\common\scripts\check-spelling-in-changed-files.ps1 ... -ExitWithError.\eng\scripts\Process-PackageReadMe.ps1 -Command validate -InputReadMePath .\servers\Azure.Mcp.Server\README.md.\eng\scripts\Update-AzCommandsMetadata.ps1.\eng\scripts\Compile-Changelog.ps1 -ChangelogPath servers\Azure.Mcp.Server\CHANGELOG.md -DryRun.\eng\scripts\Build-Local.ps1 -VerifyNpxTool selection
ToolDescriptionEvaluator passed all 21
advisor_recommendation_summaryprompts:0.409321-0.617694.A focused Vally suite against the exact locally built
azmcp.exepassed 3/3 reviewed boundaries: scoped recommendation-type ranking, overdue-inclusive retirement summary, and individual retirement records.Live Azure validation
The exact branch binary was exercised against live Advisor data for all seven groupings and every public filter/validation path.
serviceGroupIdexclusions: 0 (forward-looking filter);Advisor does not currently have deterministic recorded-test resource infrastructure for generated recommendations or global metadata. This PR follows the established Advisor exception with comprehensive command/query tests, exact local-binary Azure calls, and independent ARG comparisons.
Native AOT
.\eng\scripts\Build-Local.ps1 -IncludeNativecompleted its wrapper and packaging flow but the inner Azure MCP native publish reported existing Cosmos dependency diagnostics:IL2026andIL3050inMicrosoft.Azure.Documents.JsonSerializable.SetValueCollection<T>;MSB3077from the Native AOT compiler.The Advisor projects build with no warnings. The native failure is pre-existing and unrelated to this change.
Pre-merge Checklist
azmcp-commands.mdand regenerated metadatae2eTestPrompts.mdgroups[].keymainafter dependency Add Advisor recommendation update tool #3303 mergedInvoking 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.