Skip to content

MCP Tools in Drills: Drill Run Get and Drill Run Resource Get - #3318

Open
dynamicdhx wants to merge 1 commit into
microsoft:mainfrom
dynamicdhx:users/dhruvbharuka/drillrungetanddrillrunresourceget
Open

MCP Tools in Drills: Drill Run Get and Drill Run Resource Get#3318
dynamicdhx wants to merge 1 commit into
microsoft:mainfrom
dynamicdhx:users/dhruvbharuka/drillrungetanddrillrunresourceget

Conversation

@dynamicdhx

Copy link
Copy Markdown
Contributor

What does this PR do?

[Provide a clear, concise description of the changes]

[Add 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
    • 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

@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.

@dynamicdhx

Copy link
Copy Markdown
Contributor Author

Tool Descriptor Evaluator Results

Test 1

Expected Tool: resilience_drill_run_get
Prompt: List all runs of drill <drill_name> in service group <service_group>

Results

Rank Score Tool Status
1 0.795099 resilience_drill_run_get EXPECTED
2 0.600467 resilience_drill_get
3 0.596544 resilience_drill_run_resource_get
4 0.523022 resilience_drill_resource_get
5 0.415640 resilience_recovery_plan_get

Test 2

Expected Tool: resilience_drill_run_get
Prompt: Get drill run <drill_run_name> for drill <drill_name> in service group <service_group>

Results

Rank Score Tool Status
1 0.757379 resilience_drill_run_get EXPECTED
2 0.637246 resilience_drill_run_resource_get
3 0.563664 resilience_drill_get
4 0.505661 resilience_drill_resource_get
5 0.396332 resilience_recovery_plan_get

Test 3

Expected Tool: resilience_drill_run_resource_get
Prompt: List all resources of drill run <drill_run_name> for drill <drill_name> in service group <service_group>

Results

Rank Score Tool Status
1 0.755976 resilience_drill_run_resource_get EXPECTED
2 0.733873 resilience_drill_run_get
3 0.652398 resilience_drill_resource_get
4 0.592966 resilience_drill_get
5 0.490844 group_resource_list

Test 4

Expected Tool: resilience_drill_run_resource_get
Prompt: Get resource <resource_name> from drill run <drill_run_name> for drill <drill_name> in service group <service_group>

Results

Rank Score Tool Status
1 0.733581 resilience_drill_run_resource_get EXPECTED
2 0.644799 resilience_drill_run_get
3 0.576003 resilience_drill_resource_get
4 0.507843 resilience_drill_get
5 0.401303 resilience_goal_resource_get

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

Adds Azure Resilience Management drill run and drill run resource/target retrieval capabilities to the ResilienceManagement toolset, wiring new commands through the tool registration and updating Azure MCP Server documentation/metadata.

Changes:

  • Added azmcp resilience drill run get and azmcp resilience drill run resource get commands (plus options, JSON serialization context, and unit tests).
  • Extended IResilienceManagementService / ResilienceManagementService with DrillRun and DrillRunTarget list/get operations.
  • Updated server docs/metadata (consolidated tool mapping, e2e prompts, azmcp command reference) and added changelog entries.

Reviewed changes

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

Show a summary per file
File Description
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Drills/Runs/Resources/DrillRunResourceGetCommandTests.cs New unit tests for drill run resource list/get behavior and error handling.
tools/Azure.Mcp.Tools.ResilienceManagement/tests/Azure.Mcp.Tools.ResilienceManagement.Tests/Drills/Runs/DrillRunGetCommandTests.cs New unit tests for drill run list/get behavior and error handling.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Services/ResilienceManagementService.cs Implements ARM-backed list/get for drill runs and drill run targets.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Services/IResilienceManagementService.cs Adds service interface methods for drill runs and drill run targets.
tools/Azure.Mcp.Tools.ResilienceManagement/src/ResilienceManagementSetup.cs Registers new commands and adds drill run and drill run resource command groups.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/Drills/Runs/Resources/DrillRunResourceGetOptions.cs New options POCO for drill run resource get.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Options/Drills/Runs/DrillRunGetOption.cs New options POCO for drill run get.
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/ResilienceManagementJsonContext.cs Registers new command result types for source-generated JSON serialization (AOT).
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/Drills/Runs/Resources/DrillRunResourceGetCommand.cs New command to list/get drill run targets (resources).
tools/Azure.Mcp.Tools.ResilienceManagement/src/Commands/Drills/Runs/DrillRunGetCommand.cs New command to list/get drill runs.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Updates consolidated tool description + mapped tool list to include new drill run tools.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds e2e prompt coverage rows for the two new tools.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Documents the two new CLI command shapes.
servers/Azure.Mcp.Server/changelog-entries/copilot-add-drill-run-resource-get.yaml Changelog entry for drill run resource get tool.
servers/Azure.Mcp.Server/changelog-entries/copilot-add-drill-run-get.yaml Changelog entry for drill run get tool.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +80 to +84
RequestFailedException reqEx when reqEx.Status == (int)HttpStatusCode.Forbidden =>
"Authorization failed getting the drill run. Verify that you have access.",
RequestFailedException reqEx when reqEx.Status == (int)HttpStatusCode.NotFound =>
"Drill run not found. Verify the drill run, drill, and service group exist and you have access.",
RequestFailedException => "Failed to get the drill run. Verify the drill run, drill, and service group, then retry.",
Comment on lines +82 to +86
RequestFailedException reqEx when reqEx.Status == (int)HttpStatusCode.Forbidden =>
"Authorization failed getting the drill run resource. Verify that you have access.",
RequestFailedException reqEx when reqEx.Status == (int)HttpStatusCode.NotFound =>
"Drill run resource not found. Verify the resource, drill run, drill, and service group exist and you have access.",
RequestFailedException => "Failed to get the drill run resource. Verify the resource, drill run, drill, and service group, then retry.",
Comment on lines 45 to +48
services.AddSingleton<DrillGetCommand>();
services.AddSingleton<DrillResourceGetCommand>();
services.AddSingleton<DrillRunGetCommand>();
services.AddSingleton<DrillRunResourceGetCommand>();
Comment thread servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json
@dynamicdhx
dynamicdhx force-pushed the users/dhruvbharuka/drillrungetanddrillrunresourceget branch from ba4a907 to d1a6902 Compare August 19, 2026 02:00

namespace Azure.Mcp.Tools.ResilienceManagement.Options.Drills.Runs.Resources;

public sealed class DrillRunResourceGetOptions

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.

Nit: rename this file to DrillRunResourceGetOption.cs (singular) to match the sibling DrillRunGetOption.cs and the toolset convention (DrillGetOption.cs, DrillResourceGetOption.cs). The class name stays DrillRunResourceGetOptions.


protected override string GetErrorMessage(Exception ex) => ex switch
{
KeyNotFoundException => "Drill run not found. Verify the drill run name, drill, service group, and that you have access.",

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.

This KeyNotFoundException arm looks unreachable. GetDrillRunAsync calls the ARM GetAsync, which throws RequestFailedException with Status 404 on a missing run (already handled below), not KeyNotFoundException. Consider removing this arm (and the analogous one in DrillRunResourceGetCommand), or point to the path that actually throws it.


protected override string GetErrorMessage(Exception ex) => ex switch
{
KeyNotFoundException => "Drill run resource not found. Verify the resource name, drill run, drill, service group, and that you have access.",

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.

Same as DrillRunGetCommand: this KeyNotFoundException arm is unreachable — the ARM GetAsync throws RequestFailedException (Status 404) on a missing resource, not KeyNotFoundException. Drop it or reference the code path that throws it.


# Get a run of a drill, or list all runs of the drill (omit --name)
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp resilience drill run get --subscription <subscription> \

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.

These commands are service-group-scoped and don't expose a --subscription option, so documenting --subscription <subscription> here is inaccurate (and would be rejected under strict unknown-parameter handling). Note the existing drill get / drill resource get blocks above have the same line, so this is a pre-existing pattern — ideally fix all four together.

}

[Fact]
public async Task Should_list_drill_runs()

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.

These four new TestType=Live recorded tests were added, but assets.json isn't updated in this PR (Tag is still ..._cb0c443485), so there are no recordings for them. The default PR build runs recorded tests in playback (Test-Code.ps1 -TestType All applies no trait filter), so with no recordings they fail — which is what's reddening the test legs of mcp - pullrequest. The live pipeline needs to run to record these interactions and bump the assets Tag.

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.

3 participants