Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_virtual_machine_metrics

Retrieve virtual machine performance metrics by specifying Zone ID or VM ID to monitor and manage cloud resource utilization in CloudStack environments.

Instructions

List virtual machine performance metrics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoSpecific VM ID
zoneidNoZone ID to filter VMs

Implementation Reference

  • The handler function that implements the core logic of the 'list_virtual_machine_metrics' tool. It calls the CloudStack client to fetch metrics, processes the response, and formats it into a structured text output for the MCP protocol.
    async handleListVirtualMachineMetrics(args: any) {
      const result = await this.cloudStackClient.listVirtualMachineMetrics(args);
      const metrics = result.listvirtualmachinemetricsresponse?.virtualmachine || [];
      
      const metricsList = metrics.map((vm: any) => ({
        id: vm.id,
        name: vm.name,
        state: vm.state,
        cpuused: vm.cpuused,
        networkkbsread: vm.networkkbsread,
        networkkbswrite: vm.networkkbswrite,
        diskioread: vm.diskioread,
        diskiowrite: vm.diskiowrite,
        disksize: vm.disksize,
        memory: vm.memory,
        cpunumber: vm.cpunumber
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: `Found ${metricsList.length} virtual machine metrics:\n\n${metricsList
              .map((vm: any) => 
                `• ${vm.name} (${vm.id})\n  State: ${vm.state}\n  CPU Used: ${vm.cpuused}%\n  Memory: ${vm.memory}MB\n  CPUs: ${vm.cpunumber}\n  Disk Size: ${vm.disksize}GB\n  Network Read: ${vm.networkkbsread}KB\n  Network Write: ${vm.networkkbswrite}KB\n  Disk Read: ${vm.diskioread}KB\n  Disk Write: ${vm.diskiowrite}KB\n`
              )
              .join('\n')}`
          }
        ]
      };
    }
  • The tool schema definition including name, description, and input schema validation for the 'list_virtual_machine_metrics' tool.
    {
      name: 'list_virtual_machine_metrics',
      description: 'List virtual machine performance metrics',
      inputSchema: {
        type: 'object',
        properties: {
          zoneid: {
            type: 'string',
            description: 'Zone ID to filter VMs',
          },
          id: {
            type: 'string',
            description: 'Specific VM ID',
          },
        },
        additionalProperties: false,
      },
    },
  • src/server.ts:130-131 (registration)
    The registration/dispatch case in the MCP server's tool request handler that routes calls to the 'list_virtual_machine_metrics' tool to its handler method.
    case 'list_virtual_machine_metrics':
      return await this.vmHandlers.handleListVirtualMachineMetrics(args);
  • Helper method in CloudStack client that performs the actual API request to CloudStack's listVirtualMachineMetrics endpoint.
    async listVirtualMachineMetrics(params: CloudStackParams = {}): Promise<CloudStackResponse> {
      return this.request('listVirtualMachineMetrics', params);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the action ('List') without detailing whether this is a read-only operation, if it requires specific permissions, what the output format looks like (e.g., metrics types, time ranges), or any rate limits. This is inadequate for a tool that likely returns performance data.

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 a single, efficient sentence with no wasted words. It is front-loaded with the core purpose, making it easy to scan and understand quickly, which is ideal for conciseness.

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 the complexity of performance metrics (which could include CPU, memory, network data, etc.), no annotations, and no output schema, the description is insufficient. It doesn't explain what metrics are returned, their format, or any behavioral aspects like pagination or authentication needs, leaving significant gaps for the agent.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('id' and 'zoneid') with clear descriptions. The description adds no additional meaning beyond implying metrics are for VMs, which is already inferred from the tool name and schema. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 action ('List') and resource ('virtual machine performance metrics'), making the purpose understandable. However, it doesn't distinguish this tool from its sibling 'list_virtual_machines', which might list VMs themselves rather than their metrics, leaving some ambiguity about differentiation.

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?

No guidance is provided on when to use this tool versus alternatives like 'get_virtual_machine' or 'list_virtual_machines'. The description lacks context about prerequisites, such as needing VM IDs from other tools, or exclusions, leaving the agent without clear usage direction.

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

Related 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/phantosmax/cloudstack-mcp-server'

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