Skip to content

[BUG] Conditional parameters should be identified via CLI JSON output #1752

@diberry

Description

@diberry

Describe the bug

Currently, the only place I can find whether a parameter is conditional is reading the azmcp-commands.md file. That means the information has to be parsed manually from the markdown instead of determined from the CLI json output.

Here is an example for the Compute namespace for azmcp compute vm get and its conditional parameter resource group.

Expected behavior

CLI Json can be parsed for conditional parameters.

Actual behavior

Read azmcp-commands.md to figure out conditional parameters.

Reproduction Steps

Create CLI JSON for Compute namespace compute vm get. Resource group is not identified as a conditional parameter.

        {
            "id": "c1a8b3e5-4f2d-4a6e-8c7b-9d2e3f4a5b6c",
            "name": "get",
            "description": "List or get Azure Virtual Machines (VMs) in a subscription or resource group. Returns VM details including name, location, size, provisioning state, OS type, and instance view with runtime status and power state.",
            "command": "compute vm get",
            "option": [
                {
                    "name": "--tenant",
                    "description": "The Microsoft Entra ID tenant ID or name. This can be either the GUID identifier or the display name of your Entra ID tenant.",
                    "type": "string"
                },
                {
                    "name": "--auth-method",
                    "description": "Authentication method to use. Options: 'credential' (Azure CLI/managed identity), 'key' (access key), or 'connectionString'.",
                    "type": "string"
                },
                {
                    "name": "--retry-delay",
                    "description": "Initial delay in seconds between retry attempts. For exponential backoff, this value is used as the base.",
                    "type": "string"
                },
                {
                    "name": "--retry-max-delay",
                    "description": "Maximum delay in seconds between retries, regardless of the retry strategy.",
                    "type": "string"
                },
                {
                    "name": "--retry-max-retries",
                    "description": "Maximum number of retry attempts for failed operations before giving up.",
                    "type": "string"
                },
                {
                    "name": "--retry-mode",
                    "description": "Retry strategy to use. 'fixed' uses consistent delays, 'exponential' increases delay between attempts.",
                    "type": "string"
                },
                {
                    "name": "--retry-network-timeout",
                    "description": "Network operation timeout in seconds. Operations taking longer than this will be cancelled.",
                    "type": "string"
                },
                {
                    "name": "--subscription",
                    "description": "Specifies the Azure subscription to use. Accepts either a subscription ID (GUID) or display name. If not specified, the AZURE_SUBSCRIPTION_ID environment variable will be used instead.",
                    "type": "string"
                },
                {
                    "name": "--resource-group",
                    "description": "The name of the Azure resource group. This is a logical container for Azure resources.",
                    "type": "string"
                },
                {
                    "name": "--vm-name",
                    "description": "The name of the virtual machine",
                    "type": "string"
                },
                {
                    "name": "--instance-view",
                    "description": "Include instance view details (only available when retrieving a specific VM)",
                    "type": "string"
                }
            ],
            "metadata": {
                "destructive": {
                    "value": false,
                    "description": "This tool performs only additive updates without deleting or modifying existing resources."
                },
                "idempotent": {
                    "value": true,
                    "description": "Running this operation multiple times with the same arguments produces the same result without additional effects."
                },
                "openWorld": {
                    "value": false,
                    "description": "This tool's domain of interaction is closed and well-defined, limited to a specific set of entities (like memory access)."
                },
                "readOnly": {
                    "value": true,
                    "description": "This tool only performs read operations without modifying any state or data."
                },
                "secret": {
                    "value": false,
                    "description": "This tool does not handle sensitive or secret information."
                },
                "localRequired": {
                    "value": false,
                    "description": "This tool is available in both local and remote server modes."
                }
            }
        },

View markdown for this command in azmcp-commands.md where the conditionality is articulated after the commands.

### Azure Compute Operations

#### Virtual Machines

```bash
# Get Virtual Machine(s) - behavior depends on provided parameters
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp compute vm get --subscription <subscription> \
                     [--resource-group <resource-group>] \
                     [--vm-name <vm-name>] \
                     [--instance-view]

# Examples:

# List all VMs in subscription
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp compute vm get --subscription "my-subscription"

# List all VMs in a resource group
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp compute vm get --subscription "my-subscription" \
                     --resource-group "my-rg"

# Get specific VM details
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp compute vm get --subscription "my-subscription" \
                     --resource-group "my-rg" \
                     --vm-name "my-vm"

# Get specific VM with instance view (runtime status)
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp compute vm get --subscription "my-subscription" \
                     --resource-group "my-rg" \
                     --vm-name "my-vm" \
                     --instance-view

Command Behavior:

  • With --vm-name: Gets detailed information about a specific VM (requires --resource-group). Optionally include --instance-view for runtime status.
  • With --resource-group only: Lists all VMs in the specified resource group.
  • With neither: Lists all VMs in the subscription.

Returns:

  • VM information including name, location, VM size, provisioning state, OS type, license type, zones, and tags.
  • When --instance-view is specified: Also includes power state, provisioning state, VM agent status, disk status, and extension status.

Parameters:

Parameter Required Description
--subscription Yes Azure subscription ID
--resource-group, -g Conditional Resource group name (required when using --vm-name)
--vm-name, --name No Name of the virtual machine
--instance-view No Include instance view details (only available with --vm-name)

### Environment

npm cli

Metadata

Metadata

Assignees

Labels

needs-team-triageWorkflow: This issue needs the team to triage.server-Azure.McpAzure.Mcp.Servertools-CoreAZMCP Core functionality that all other tools build on top of

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions