Skip to main content
Glama

get_vm_status

Check the current operational state of a virtual machine, such as running or stopped, to monitor its availability and manage resources.

Instructions

Get the current status of a VM (running, stopped, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesVM ID

Implementation Reference

  • Primary handler function for get_vm_status tool. Fetches VM details by ID, retrieves all machine statuses, matches by machine ID, and returns formatted status information.
    async getVMStatus(id) { // Get VM to find machine ID, then get status const vm = await this.request(`/api/v4/vms/${id}?fields=most`); const statuses = await this.request("/api/v4/machine_status"); const status = statuses.find(s => s.machine === vm.machine); if (!status) { return { vm_id: id, name: vm.name, power_state: "unknown", running: false }; } return { vm_id: id, name: vm.name, machine: vm.machine, running: status.running, power_state: status.status, status_info: status.status_info || "", migratable: status.migratable, }; }
  • Tool registration in the TOOLS array, including name, description, and input schema for MCP server.
    { name: "get_vm_status", description: "Get the current status of a VM", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID" } }, required: ["id"] } },
  • Simplified handler in stdio MCP server that directly queries machine_status assuming id is machine ID.
    async getVMStatus(id) { return this.request(`/api/v4/machine_status?machine=${id}`); }
  • src/index.js:280-292 (registration)
    Tool registration definition in stdio MCP server.
    name: "get_vm_status", description: "Get the current status of a VM (running, stopped, etc.)", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID", }, }, required: ["id"], }, },
  • Handler in direct connection MCP server, similar to mcp-http-server, mapping VM ID to machine status.
    async function getVMStatus(id) { const vm = await apiRequest(`/api/v4/vms/${id}?fields=most`); const statuses = await apiRequest("/api/v4/machine_status"); const status = statuses.find(s => s.machine === vm.machine) || {}; return { id, name: vm.name, running: status.running || false, status: status.running ? "running" : "stopped" }; }

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/dvvincent/vergeos-mcp-server'

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