Skip to main content
Glama
dvvincent

VergeOS MCP Server

by dvvincent

power_off_vm

Gracefully shut down a virtual machine in VergeOS by specifying its VM ID to manage virtualization resources.

Instructions

Power off a virtual machine (graceful shutdown)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesVM ID to power off

Implementation Reference

  • Primary handler for 'power_off_vm' MCP tool. Sends graceful 'poweroff' API action, optionally waits/polls for shutdown completion, and forces 'kill' if timeout expires and force_after_timeout is true.
    async powerOffVM(id, options = {}) {
      const { wait_timeout = 0, force_after_timeout = false } = options;
      const status = await this.getVMStatus(id);
      
      if (!status.running) {
        return { success: true, message: `VM '${status.name}' is already stopped`, current_state: status.power_state, was_running: false };
      }
      
      // Send graceful shutdown
      await this.vmAction(id, "poweroff");
      
      // If no wait requested, return immediately
      if (wait_timeout <= 0) {
        return { 
          success: true, 
          message: `Graceful shutdown command sent to VM '${status.name}'`, 
          previous_state: status.power_state,
          note: "Use wait_timeout parameter to wait for shutdown completion"
        };
      }
      
      // Poll for shutdown with timeout
      const startTime = Date.now();
      const pollInterval = 3000; // 3 seconds
      const maxWait = Math.min(wait_timeout, 300) * 1000; // Cap at 5 minutes
      
      while (Date.now() - startTime < maxWait) {
        await new Promise(resolve => setTimeout(resolve, pollInterval));
        const currentStatus = await this.getVMStatus(id);
        
        if (!currentStatus.running) {
          return { 
            success: true, 
            message: `VM '${status.name}' shut down gracefully`, 
            final_state: currentStatus.power_state,
            elapsed_seconds: Math.round((Date.now() - startTime) / 1000)
          };
        }
      }
      
      // Timeout reached - check if we should force
      if (force_after_timeout) {
        await this.vmAction(id, "kill");
        // Wait a moment for kill to take effect
        await new Promise(resolve => setTimeout(resolve, 2000));
        const finalStatus = await this.getVMStatus(id);
        return { 
          success: true, 
          message: `VM '${status.name}' did not shut down within ${wait_timeout}s - forced power off`, 
          final_state: finalStatus.power_state,
          forced: true,
          elapsed_seconds: Math.round((Date.now() - startTime) / 1000)
        };
      }
      
      // Timeout without force
      const currentStatus = await this.getVMStatus(id);
      return { 
        success: false, 
        error: `VM '${status.name}' did not shut down within ${wait_timeout}s`, 
        current_state: currentStatus.power_state,
        elapsed_seconds: Math.round((Date.now() - startTime) / 1000),
        hint: "Use force_after_timeout=true to automatically force shutdown after timeout"
      };
    }
  • Dispatch/execution point for 'power_off_vm' tool in MCP HTTP server's executeTool function.
    case "power_off_vm": return api.powerOffVM(args.id, { wait_timeout: args.wait_timeout, force_after_timeout: args.force_after_timeout });
  • Tool registration entry in TOOLS array, including schema defining id (required), wait_timeout, and force_after_timeout parameters.
    { name: "power_off_vm", description: "Power off a virtual machine (graceful shutdown). Use wait_timeout to wait for completion, and force_after_timeout to auto-force if graceful shutdown fails.", inputSchema: { type: "object", properties: { id: { type: "number", description: "VM ID" }, wait_timeout: { type: "number", description: "Seconds to wait for graceful shutdown (0 = don't wait, max 300). Recommended: 60-120 for most VMs." }, force_after_timeout: { type: "boolean", description: "If true, force power off after wait_timeout expires. Recommended: true for reliable shutdown." } }, required: ["id"] } },
  • Helper method used by powerOffVM to send the actual 'poweroff' or 'kill' action to the VergeOS API.
    async vmAction(id, action) {
      return this.request("/api/v4/vm_actions", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ vm: id, action }),
      });
    }
  • Simpler handler implementation in stdio MCP server, directly calls vmAction without wait/force logic.
    async powerOffVM(id) {
      return this.vmAction(id, "poweroff");
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'graceful shutdown,' which implies a safe, orderly power-off rather than a forced stop, but fails to cover critical aspects like required permissions, potential side effects (e.g., data loss if unsaved), rate limits, or response behavior. For a mutation tool with zero annotation coverage, this is a significant gap.

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 that front-loads the core action ('power off a virtual machine') and adds clarifying detail ('graceful shutdown') without unnecessary words. Every part earns its place, making it highly concise and well-structured.

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 tool's complexity as a mutation operation (powering off a VM) with no annotations, no output schema, and incomplete behavioral transparency, the description is insufficient. It lacks details on permissions, side effects, error conditions, or what to expect upon success, leaving critical gaps for an AI agent to use it safely and effectively.

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%, with the single parameter 'id' documented as 'VM ID to power off.' The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles the 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 ('power off') and target resource ('virtual machine'), with the parenthetical 'graceful shutdown' adding specificity about the shutdown method. However, it doesn't explicitly differentiate from sibling tools like 'reset_vm' (which might imply a hard reset) or 'power_on_vm' (the opposite action), missing full sibling 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?

The description provides no guidance on when to use this tool versus alternatives like 'reset_vm' or 'power_on_vm', nor does it mention prerequisites (e.g., VM must be powered on) or exclusions. It's a basic statement of function without contextual usage information.

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

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