Skip to content

Refresh Azure.Sdk.Tools.Mock handler coverage to match live MCP tool list (#15852)#15854

Merged
helen229 merged 8 commits into
mainfrom
feat/mock-refresh-15852
Jun 4, 2026
Merged

Refresh Azure.Sdk.Tools.Mock handler coverage to match live MCP tool list (#15852)#15854
helen229 merged 8 commits into
mainfrom
feat/mock-refresh-15852

Conversation

@helen229

@helen229 helen229 commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

Brings Azure.Sdk.Tools.Mock back in sync with the live Azure.Sdk.Tools.Cli MCP tool list by adding IMockToolHandler implementations for the 63 tools that previously fell back to the generic {"message":"Success"} default response.

Closes #15852.

Why

The mock auto-advertises every live tool via reflection over SharedOptions.ToolsList, so the tool list never drifts. What does drift is handler coverage: tools without an IMockToolHandler return the placeholder default. That's fine for routing tests but breaks chained-call eval scenarios (e.g. create_release_plan → use returned release_plan_id in the next call). Most of the live tool set had no handler — this PR brings coverage to 74/74.

Changes

Added hand-written IMockToolHandler implementations grouped by domain. Each handler returns the same typed CommandResponse subtype as the live tool, populated with realistic sample data:

  • Handlers/APIView/ApiViewHandlers.cs
  • Handlers/Config/ConfigHandlers.cs — service-label + codeowners
  • Handlers/Core/UpgradeHandler.cs
  • Handlers/EngSys/EngSysHandlers.cs — log analysis, failed tests, cleanup
  • Handlers/Example/ExampleAndDebugHandlers.cs — example services + hello-world-fail
  • Handlers/GitHub/GitHubHandlers.cs
  • Handlers/Package/PackageOperationHandlers.cs
  • Handlers/Pipeline/AnalyzeAndArtifactsHandlers.cs
  • Handlers/ReleasePlan/ReleasePlanRemainingHandlers.cs
  • Handlers/TypeSpec/TypeSpecHandlers.cs
  • Handlers/Verify/VerifySetupHandler.cs

Updated tools/azsdk-cli/Azure.Sdk.Tools.Mock/README.md with the workflow for adding a handler when a new MCP tool is introduced.

Verification

dotnet build tools/azsdk-cli/Azure.Sdk.Tools.Mock — 0 errors (1 pre-existing CS9107 warning in MockToolRegistrations.cs, unrelated).

Follow-ups (not in this PR)

Automated drift detection (live tool with no handler, or handler with only the placeholder default) — likely a unit test in Azure.Sdk.Tools.Cli.Tests that reflects over both sets and invokes each handler. Out of scope here; this PR just fixes the existing gap.

- New eng/scripts/Get-McpToolInventory.ps1 boots the live Azure.Sdk.Tools.Cli MCP server (via 'azsdk list -o json'), enumerates the IMockToolHandler implementations under Azure.Sdk.Tools.Mock, and reports the diff in three buckets: both / live-only / mock-only.

- Cross-references mock-tier eval YAMLs under tools/azsdk-cli/Azure.Sdk.Tools.Vally/evals/ when present; gracefully no-ops when that folder hasn't landed yet (PR #15811).

- '-CheckOnly' exits non-zero on (a) any stale handler that no longer maps to a live tool, or (b) any tool referenced by a mock-tier eval without a handler -- intended for the CI job tracked in #15829.

- Documents the drift workflow in Azure.Sdk.Tools.Mock/README.md so a contributor flagged by the script knows how to add a handler. No stale handlers detected against the current live tool set.
@github-actions github-actions Bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Jun 3, 2026
helen229 added 3 commits June 3, 2026 11:24
…om inventory script (#15852)

- 13 new handler files covering 63 live tools that previously fell back to the default response (APIView, Codeowners, EngSys, GitHub, Package, Pipeline, ReleasePlan, TypeSpec, Verify, Core, Example).
- Get-McpToolInventory.ps1: pure live-vs-mock parity (removes Vally eval cross-reference); -CheckOnly fails if either bucket is non-empty.
- README: updated sync workflow to reflect parity-only check.
@helen229 helen229 marked this pull request as ready for review June 3, 2026 18:46
@helen229 helen229 requested a review from a team as a code owner June 3, 2026 18:46
Copilot AI review requested due to automatic review settings June 3, 2026 18:46
@helen229 helen229 requested a review from a team as a code owner June 3, 2026 18:46
Comment thread eng/scripts/Get-McpToolInventory.ps1 Outdated

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.

Pull request overview

This PR updates Azure.Sdk.Tools.Mock to provide hand-written mock handlers for the Azure SDK Tools CLI MCP toolset and adds a PowerShell script to detect drift between the live tool inventory and the mock handler inventory, with accompanying documentation updates.

Changes:

  • Added domain-grouped IMockToolHandler implementations returning typed CommandResponse payloads with realistic sample data.
  • Added eng/scripts/Get-McpToolInventory.ps1 to compare live MCP tools (azsdk list -o json) vs. mock handler ToolName declarations and report drift.
  • Updated Azure.Sdk.Tools.Mock/README.md to document the sync workflow.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/azsdk-cli/Azure.Sdk.Tools.Mock/README.md Documents the handler sync workflow and drift-check usage.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Verify/VerifySetupHandler.cs Adds a mock azsdk_verify_setup handler returning a successful typed response.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/TypeSpec/TypeSpecHandlers.cs Adds mock handlers for TypeSpec-related tools with typed responses.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/ReleasePlan/ReleasePlanRemainingHandlers.cs Adds mock handlers for remaining release-plan tools (some response types currently diverge from live).
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Pipeline/AnalyzeAndArtifactsHandlers.cs Adds mock handlers for pipeline analysis and artifact listing tools.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Package/PackageOperationHandlers.cs Adds mock handlers for package operations (generate/build/test/check/pack/etc.).
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/GitHub/GitHubHandlers.cs Adds mock handlers for GitHub-related tools (PR/user details).
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Example/ExampleAndDebugHandlers.cs Adds mock handlers for example/debug tools including deterministic failure paths.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/EngSys/EngSysHandlers.cs Adds mock handlers for engsys log/test failure analysis and cleanup tools.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Core/UpgradeHandler.cs Adds a mock azsdk_upgrade handler returning an “already up to date” response.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/Config/ConfigHandlers.cs Adds mock handlers for service label and CODEOWNERS tooling.
tools/azsdk-cli/Azure.Sdk.Tools.Mock/Handlers/APIView/ApiViewHandlers.cs Adds mock handlers for APIView comment/review URL/copilot review tools.
eng/scripts/Get-McpToolInventory.ps1 Adds a drift-detection script comparing live tool list vs. mock handler coverage.

Comment thread eng/scripts/Get-McpToolInventory.ps1 Outdated
Comment thread eng/scripts/Get-McpToolInventory.ps1 Outdated
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Mock/README.md Outdated
Comment thread eng/scripts/Get-McpToolInventory.ps1 Outdated
helen229 added 2 commits June 3, 2026 12:03
Addresses Copilot review on PR #15854:
- azsdk_get_kpi_attestation_status: ReleaseWorkflowResponse -> ReleasePlanListResponse
- azsdk_get_service_details_by_typespec_path: ReleaseWorkflowResponse -> ProductInfoResponse
- azsdk_update_language_exclusion_justification: ReleaseWorkflowResponse -> DefaultCommandResponse
Per review discussion: the script only checked that an IMockToolHandler exists with the right ToolName; it could not detect handlers that exist but just return the placeholder DefaultCommandResponse. That blind spot makes the script of limited value. A unit test in Cli.Tests is a better fit for actual drift enforcement and is tracked as a follow-up. README updated to drop the script reference.
@helen229 helen229 changed the title Add MCP tool-coverage drift check for Azure.Sdk.Tools.Mock (#15852) Refresh Azure.Sdk.Tools.Mock handler coverage to match live MCP tool list (#15852) Jun 3, 2026
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Mock/README.md
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Mock/README.md
@helen229 helen229 merged commit 7511fa4 into main Jun 4, 2026
12 checks passed
@helen229 helen229 deleted the feat/mock-refresh-15852 branch June 4, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh Azure.Sdk.Tools.Mock + add MCP tool-coverage drift check

4 participants