Skip to main content
Glama

wait_for_vm

Waits for a virtual machine to reach a specific status (stopped, started, paused) within a set timeout. Enables reliable orchestration of VM actions.

Instructions

Wait until a VM reaches a target status.

Useful for orchestration — start a VM then wait for it to be ready.

Args: name: VM name target_status: Status to wait for: "stopped", "started", or "paused" timeout: Seconds to wait (default: 120)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
target_statusNostarted
timeoutNo

Implementation Reference

  • MCP tool handler for 'wait_for_vm'. Uses the @mcp.tool() decorator to register the tool. Delegates to utm.wait_for_vm() and returns dict with name and status.
    @mcp.tool()
    def wait_for_vm(name: str, target_status: str = "started", timeout: int = 120) -> dict:
        """Wait until a VM reaches a target status.
    
        Useful for orchestration — start a VM then wait for it to be ready.
    
        Args:
            name: VM name
            target_status: Status to wait for: "stopped", "started", or "paused"
            timeout: Seconds to wait (default: 120)
        """
        status = utm.wait_for_vm(name, target_status=target_status, timeout=timeout)
        return {"name": name, "status": status}
  • Core AppleScript helper that polls VM status until target is reached or timeout. Validates inputs, then loops calling get_vm_status every 2 seconds.
    def wait_for_vm(name: str, target_status: str = "started", timeout: int = 120) -> str:
        """Poll VM status until it matches target or timeout is reached."""
        _validate_vm_name(name)
        if target_status not in _VALID_STATUSES:
            raise ValueError(f"Invalid target_status '{target_status}'. Must be one of: {_VALID_STATUSES}")
        timeout = _validate_timeout(timeout)
    
        status = get_vm_status(name)
        deadline = time.monotonic() + timeout
        while time.monotonic() < deadline:
            if status == target_status:
                return status
            time.sleep(2)
            status = get_vm_status(name)
        raise TimeoutError(f"VM '{name}' did not reach '{target_status}' within {timeout}s (current: {status})")
  • Tool registration via @mcp.tool() decorator on the wait_for_vm function. Makes 'wait_for_vm' available as an MCP tool.
    @mcp.tool()
    def wait_for_vm(name: str, target_status: str = "started", timeout: int = 120) -> dict:
  • Input parameters: name (str), target_status (str, default 'started'), timeout (int, default 120). Return type: dict with name and status keys.
    @mcp.tool()
    def wait_for_vm(name: str, target_status: str = "started", timeout: int = 120) -> dict:
        """Wait until a VM reaches a target status.
    
        Useful for orchestration — start a VM then wait for it to be ready.
    
        Args:
            name: VM name
            target_status: Status to wait for: "stopped", "started", or "paused"
            timeout: Seconds to wait (default: 120)
        """
        status = utm.wait_for_vm(name, target_status=target_status, timeout=timeout)
        return {"name": name, "status": status}
Behavior3/5

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

No annotations provided, so description must explain behavior. It mentions waiting and timeout, but does not specify polling interval, blocking nature, or behavior on timeout expiry (e.g., error vs success). This leaves some ambiguity.

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?

Description is four sentences, front-loaded with purpose and usage hint, then parameter details. Every sentence adds value with no redundancy.

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

Completeness3/5

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

Covers essential purpose and parameters, but lacks information about return values or error handling (e.g., what happens on timeout). Given no output schema, more detail on timeout behavior would improve completeness.

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

Parameters4/5

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

Schema coverage is 0%, but the description includes an Args block that explains each parameter, including valid target_status values and timeout default. This adds significant meaning beyond the raw schema.

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

Purpose5/5

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

The description clearly states the tool waits for a VM to reach a target status, using specific verb and resource. It distinguishes itself from sibling tools like start_vm or stop_vm by focusing on the waiting/polling aspect.

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

Usage Guidelines4/5

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

Description gives a clear usage context ('Useful for orchestration — start a VM then wait for it to be ready'), implying when to use it. However, it lacks explicit when-not-to-use or alternative tool references.

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/neverprepared/mcp-utm'

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