Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

get_virtual_machine

Retrieve detailed information about a specific virtual machine using its unique VM ID in the CloudStack MCP Server environment.

Instructions

Get details of a specific virtual machine

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesVM ID

Implementation Reference

  • The core handler function that implements the logic for the 'get_virtual_machine' tool. It queries CloudStack API for the VM by ID, handles not found cases, and returns formatted details in MCP content format.
    async handleGetVirtualMachine(args: any) { const result = await this.cloudStackClient.listVirtualMachines({ id: args.id }); const vms = result.listvirtualmachinesresponse?.virtualmachine || []; if (vms.length === 0) { return { content: [ { type: 'text', text: `Virtual machine with ID ${args.id} not found.` } ] }; } const vm = vms[0]; return { content: [ { type: 'text', text: `Virtual Machine Details:\n\nID: ${vm.id}\nName: ${vm.name}\nDisplay Name: ${vm.displayname}\nState: ${vm.state}\nZone: ${vm.zonename}\nTemplate: ${vm.templatename}\nService Offering: ${vm.serviceofferingname}\nCPUs: ${vm.cpunumber}\nMemory: ${vm.memory}MB\nIP Address: ${vm.nic?.[0]?.ipaddress}\nHostname: ${vm.hostname}\nCreated: ${vm.created}\nHypervisor: ${vm.hypervisor}\nRoot Device Type: ${vm.rootdevicetype}\nSecurityGroups: ${vm.securitygroup?.map((sg: any) => sg.name).join(', ') || 'None'}` } ] }; }
  • The tool definition including name, description, and input schema for 'get_virtual_machine', which requires a 'id' string parameter.
    { name: 'get_virtual_machine', description: 'Get details of a specific virtual machine', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'VM ID', }, }, required: ['id'], additionalProperties: false, }, }, {
  • src/server.ts:110-111 (registration)
    Registration in the MCP server request handler switch statement that routes 'get_virtual_machine' calls to the VM handler.
    case 'get_virtual_machine': return await this.vmHandlers.handleGetVirtualMachine(args);
  • Aggregation of all tool definitions including virtualMachineTools (which contains get_virtual_machine) for the MCP listTools response.
    export const allToolDefinitions = [ ...virtualMachineTools, ...storageTools, ...networkTools, ...monitoringTools, ...adminTools, ...securityTools, ];
  • src/cli.ts:334-334 (registration)
    CLI command mapping for 'get-vm' to the 'get_virtual_machine' tool name.
    'get-vm': 'get_virtual_machine',

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