Skip to content

Migrate Compute tools to new tool design#3096

Open
alzimmermsft wants to merge 2 commits into
microsoft:mainfrom
alzimmermsft:MigrateComputeToNewToolDesign
Open

Migrate Compute tools to new tool design#3096
alzimmermsft wants to merge 2 commits into
microsoft:mainfrom
alzimmermsft:MigrateComputeToNewToolDesign

Conversation

@alzimmermsft

Copy link
Copy Markdown
Contributor

What does this PR do?

Migrates Compute tools to new design where Register and Bind options are based on Option attributes.

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

@alzimmermsft alzimmermsft self-assigned this Jul 17, 2026
Copilot AI review requested due to automatic review settings July 17, 2026 22:25
@alzimmermsft
alzimmermsft requested review from a team, audreyttt and g2vinay as code owners July 17, 2026 22:25
@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.

Pull request overview

This PR migrates the Azure Compute toolset from the legacy RegisterOptions/BindOptions pattern to the new attribute-based [Option] binding model, aligning Compute commands with the newer SubscriptionCommand<TOptions, TResult> command design used across the repo.

Changes:

  • Replaced legacy Compute option definitions/base options with per-command option POCOs using [Option] attributes and ISubscriptionOption.
  • Updated Compute commands (VM, VMSS, Disk) to use SubscriptionCommand<TOptions, TResult> and consolidated some response result models (e.g., VmGetResult, VmssGetResult).
  • Updated unit tests to use the newer subscription command test base and adjusted expectations/arguments for updated option binding and service signatures.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vmss/VmssUpdateCommandTests.cs Switches to new command test base and updates tags-clearing invocation for new binding behavior.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vmss/VmssGetCommandTests.cs Updates tests for consolidated VmssGetResult response model and new test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vmss/VmssDeleteCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vmss/VmssCreateCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vm/VmUpdateCommandTests.cs Updates service call expectations for signature changes (e.g., bootDiagnostics type) and new test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vm/VmPowerStateCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vm/VmGetCommandTests.cs Updates tests for consolidated VmGetResult response model and new test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vm/VmDeleteCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Vm/VmCreateCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Disk/DiskUpdateCommandTests.cs Migrates to new test base and updates expectations for signature/binding changes.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Disk/DiskGetCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Disk/DiskDeleteCommandTests.cs Migrates to new subscription command unit test base.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.Tests/Disk/DiskCreateCommandTests.cs Migrates to new subscription command unit test base and updates expectations for signature/binding changes.
tools/Azure.Mcp.Tools.Compute/src/Services/IComputeService.cs Updates Compute service contracts (e.g., bootDiagnostics / enableBursting moved to bool?).
tools/Azure.Mcp.Tools.Compute/src/Services/ComputeService.cs Implements updated service contracts and simplifies patch/creation object initialization.
tools/Azure.Mcp.Tools.Compute/src/Options/Vmss/VmssUpdateOptions.cs Introduces [Option]-based VMSS update options (including required fields and retry container).
tools/Azure.Mcp.Tools.Compute/src/Options/Vmss/VmssGetOptions.cs Introduces [Option]-based VMSS get options with optional name/instance-id and subscription scope.
tools/Azure.Mcp.Tools.Compute/src/Options/Vmss/VmssDeleteOptions.cs Introduces [Option]-based VMSS delete options with required name/resource-group and force deletion flag.
tools/Azure.Mcp.Tools.Compute/src/Options/Vmss/VmssCreateOptions.cs Introduces [Option]-based VMSS create options with required inputs and defaults.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmUpdateOptions.cs Introduces [Option]-based VM update options; changes boot diagnostics to bool?.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmPowerStateOptions.cs Introduces [Option]-based VM power state options with validation-oriented fields.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmGetOptions.cs Introduces [Option]-based VM get options (optional name, instance-view flag).
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmDeleteOptions.cs Introduces [Option]-based VM delete options with required name/resource-group and force deletion flag.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmCreateOptions.cs Introduces [Option]-based VM create options with required inputs and network-related options.
tools/Azure.Mcp.Tools.Compute/src/Options/Disk/DiskUpdateOptions.cs Introduces [Option]-based disk update options; changes enable bursting to bool? and renames disk-access field.
tools/Azure.Mcp.Tools.Compute/src/Options/Disk/DiskGetOptions.cs Introduces [Option]-based disk get options (pattern/name + subscription scope).
tools/Azure.Mcp.Tools.Compute/src/Options/Disk/DiskDeleteOptions.cs Introduces [Option]-based disk delete options with required name/resource-group.
tools/Azure.Mcp.Tools.Compute/src/Options/Disk/DiskCreateOptions.cs Introduces [Option]-based disk create options; changes enable bursting to bool? and renames disk-access field.
tools/Azure.Mcp.Tools.Compute/src/Options/ComputeOptionDescriptions.cs New centralized option description constants replacing legacy OptionDefinitions.
tools/Azure.Mcp.Tools.Compute/src/Options/ComputeOptionDefinitions.cs Removes legacy System.CommandLine option definitions.
tools/Azure.Mcp.Tools.Compute/src/Options/BaseComputeOptions.cs Removes legacy base options type that customized resource-group binding.
tools/Azure.Mcp.Tools.Compute/src/GlobalUsings.cs Removes global usings tied to legacy System.CommandLine usage.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vmss/VmssUpdateCommand.cs Migrates VMSS update command to SubscriptionCommand<TOptions, TResult> and attribute-bound validation.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vmss/VmssGetCommand.cs Migrates VMSS get command and consolidates output to VmssGetResult with null-ignored properties.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vmss/VmssDeleteCommand.cs Migrates VMSS delete command to new command design and updates result record visibility.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vmss/VmssCreateCommand.cs Migrates VMSS create command to new command design and moves validations to ValidateOptions.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmUpdateCommand.cs Migrates VM update command to new command design and updates validation logic to property-based checks.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmPowerStateCommand.cs Migrates VM power state command to new command design and moves action validation into ValidateOptions.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmGetCommand.cs Migrates VM get command and consolidates output to VmGetResult with null-ignored properties.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmDeleteCommand.cs Migrates VM delete command to new command design and updates result record visibility.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmCreateCommand.cs Migrates VM create command to new command design and moves validations to ValidateOptions.
tools/Azure.Mcp.Tools.Compute/src/Commands/Disk/DiskUpdateCommand.cs Migrates disk update command to new command design and updates binding/validation logic.
tools/Azure.Mcp.Tools.Compute/src/Commands/Disk/DiskGetCommand.cs Migrates disk get command to new command design and updates binding to new options shape.
tools/Azure.Mcp.Tools.Compute/src/Commands/Disk/DiskDeleteCommand.cs Migrates disk delete command to new command design and updates binding to new options shape.
tools/Azure.Mcp.Tools.Compute/src/Commands/Disk/DiskCreateCommand.cs Migrates disk create command to new command design and updates binding/validation logic.
tools/Azure.Mcp.Tools.Compute/src/Commands/ComputeJsonContext.cs Updates AOT JSON context registrations for consolidated result models and simplified type references.
tools/Azure.Mcp.Tools.Compute/src/Commands/BaseComputeCommand.cs Removes legacy command base that wrapped old option registration/binding behavior.
tools/Azure.Mcp.Tools.Compute/src/Azure.Mcp.Tools.Compute.csproj Removes System.CommandLine dependency and aligns Core project reference format.
servers/Azure.Mcp.Server/changelog-entries/1784327078851.yaml Adds breaking-change entry related to the Compute tool migration.

Comment on lines +29 to 30
[Option(Description = "Enable or disable overprovisioning. When enabled, Azure provisions more VMs than requested and deletes extra VMs after deployment")]
public string? ScaleInPolicy { get; set; }
Comment on lines +53 to +56
validationResult.Errors.Add("At least one update property must be provided "
+ "(size-gb, sku, disk-iops-read-write, disk-mbps-read-write, max-shares, "
+ "network-access-policy, enable-bursting, tags, disk-encryption-set, "
+ "encryption-type, disk-access-id, or tier).");
Comment on lines +1 to +3
changes:
- section: "Breaking Changes"
description: "Removed unused parameters from Compute tools."
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.

2 participants