Skip to main content
Glama

stop_vm

Stop a running VM. Use force option to shut down when graceful stop fails.

Instructions

Stop a running VM.

Args: name: VM name force: Force stop if graceful shutdown fails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
forceNo

Implementation Reference

  • The stop_vm tool is registered as an MCP tool via the @mcp.tool() decorator on line 55.
    @mcp.tool()
    def stop_vm(name: str, force: bool = False) -> dict:
  • The MCP tool handler function for stop_vm that accepts name and force parameters and delegates to the AppleScript helper.
    @mcp.tool()
    def stop_vm(name: str, force: bool = False) -> dict:
        """Stop a running VM.
    
        Args:
            name: VM name
            force: Force stop if graceful shutdown fails
        """
        status = utm.stop_vm(name, force=force)
        return {"name": name, "status": status}
  • The core AppleScript helper function that executes the 'stop vm' command via osascript, with optional force flag.
    def stop_vm(name: str, force: bool = False) -> str:
        """Stop a VM. Returns status after stop command."""
        _validate_vm_name(name)
        method = "by force" if force else ""
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            stop vm {method}
            return status of vm as text
        end tell
        '''
        return _run(script, timeout=60)
  • Input validation helper (_validate_vm_name) called by stop_vm to ensure the VM name is safe for AppleScript interpolation.
    def _validate_vm_name(name: str) -> str:
        if not name or not _VM_NAME_RE.match(name):
            raise ValueError(f"Invalid VM name: {name!r} — only word characters, spaces, hyphens, and dots allowed")
        return name
  • Test registration verification that confirms 'stop_vm' is one of the 22 registered tools.
    "list_vms", "get_vm", "clone_vm", "start_vm", "stop_vm", "delete_vm",
Behavior2/5

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

The description mentions the 'force' parameter and graceful shutdown, but fails to disclose behavioral traits like state changes, permissions, or side effects. With no annotations, more detail is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short and includes an 'Args' section for clarity. Every sentence adds value, but it could be slightly more concise without the 'Args' repetition.

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?

For a simple tool with 2 parameters and no output schema, the description covers the basics but omits return values, state changes, or prerequisites like VM status.

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 adds meaningful explanations for both parameters: 'VM name' for name and 'Force stop if graceful shutdown fails' for force, going beyond raw types.

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 'Stop a running VM' with a specific verb ('Stop') and resource ('VM'), distinguishing it from siblings like start_vm or suspend_vm.

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 (e.g., suspend_vm) or when to set the 'force' parameter. The description lacks context for appropriate usage.

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