Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

azure_list_virtual_machines

Retrieve a list of all Azure Virtual Machines in your subscription. Specify subscription ID and optional region to view deployed instances.

Instructions

List all Virtual Machines in Azure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriptionIdNoAzure subscription ID
locationNoAzure location/regioneastus

Implementation Reference

  • Tool definition with name, description, and input schema for azure_list_virtual_machines
    {
      name: 'azure_list_virtual_machines',
      description: 'List all Virtual Machines in Azure',
      inputSchema: {
        type: 'object',
        properties: {
          subscriptionId: {
            type: 'string',
            description: 'Azure subscription ID',
          },
          location: {
            type: 'string',
            description: 'Azure location/region',
            default: 'eastus',
          },
        },
      },
    },
  • Tool handler switch case: initializes AzureAdapter, calls listVirtualMachines, maps and returns VM list with total count
    case 'azure_list_virtual_machines': {
      const vms = await adapter.listVirtualMachines();
      return {
        total: vms.length,
        virtualMachines: vms.map((vm) => ({
          id: vm.id,
          name: vm.name,
          resourceGroup: vm.resourceGroup,
          location: vm.location,
          vmSize: vm.vmSize,
          osType: vm.osType,
          status: vm.status,
          privateIp: vm.privateIp,
          publicIp: vm.publicIp,
        })),
      };
    }
  • Core implementation: initializes clients, lists resource groups, fetches VMs per group with status and details using Azure ComputeManagementClient
    async listVirtualMachines(): Promise<AzureVM[]> {
      await this.initializeClients();
      if (!this.computeClient) throw new Error('Compute client not initialized');
    
      try {
        const vms: AzureVM[] = [];
        const resourceGroups = await this.listResourceGroups();
    
        for (const rg of resourceGroups) {
          const vmList = this.computeClient.virtualMachines.list(rg);
          for await (const vm of vmList) {
            if (vm.id && vm.name) {
              // Get VM status
              const instanceView = await this.computeClient.virtualMachines.instanceView(rg, vm.name);
              const status = this.mapVMStatus(instanceView.statuses);
    
              // Get network info
              const networkInterfaces = vm.networkProfile?.networkInterfaces || [];
              let privateIp: string | undefined;
              let publicIp: string | undefined;
    
              if (networkInterfaces.length > 0 && this.resourceClient) {
                // Simplified - would need to fetch actual IPs from network interfaces
              }
    
              vms.push({
                id: vm.id,
                type: 'instance',
                name: vm.name,
                resourceGroup: rg,
                location: vm.location || this.location,
                status,
                vmSize: vm.hardwareProfile?.vmSize || '',
                osType: vm.storageProfile?.osDisk?.osType || 'Unknown',
                privateIp,
                publicIp,
                provisioningState: vm.provisioningState,
                tags: vm.tags,
              });
            }
          }
        }
    
        return vms;
      } catch (error) {
        throw new Error(`Failed to list VMs: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • src/server.ts:19-27 (registration)
    Registers azure_list_virtual_machines by including azureTools in the allTools list provided to MCP listTools handler
    const allTools = [
      ...awsTools,
      ...azureTools,
      ...gcpTools,
      ...resourceManagementTools,
      ...costAnalysisTools,
      ...monitoringTools,
      ...securityTools,
    ];
  • src/server.ts:66-67 (registration)
    Routes calls to azure_list_virtual_machines to the handleAzureTool function in MCP callTool handler
    } else if (azureTools.some((t) => t.name === name)) {
      result = await handleAzureTool(name, args || {});
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does ('List all Virtual Machines') without mentioning whether this is a read-only operation, if it requires specific permissions, how results are returned (pagination, format), or any rate limits. For a cloud resource listing tool, this leaves significant behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's purpose with zero wasted words. It's front-loaded and gets straight to the point without any unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a cloud resource listing tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what information is returned about each VM, how results are structured, whether there are limitations on what's listed, or any authentication requirements. The agent would need to guess about important operational aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with both parameters clearly documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema, so it meets the baseline expectation but doesn't provide extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('Virtual Machines in Azure'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'azure_list_storage_accounts' or 'list_resources', but the specificity of 'Virtual Machines' provides good clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_resources', 'get_resource', or other cloud-specific listing tools. There's no mention of prerequisites, context, or exclusions that would help an agent choose appropriately among similar listing operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/code-alchemist01/Cloud-mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server