Skip to main content
Glama

suspend_vm

Suspend a running virtual machine to memory and optionally save its state to disk for later resume.

Instructions

Suspend a running VM to memory.

Args: name: VM name (must be running) save: Save VM state to disk for later resume (default: True)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
saveNo

Implementation Reference

  • MCP tool handler that exposes suspend_vm as a @mcp.tool() — calls utm.suspend_vm (the AppleScript helper) and returns the VM name and status.
    @mcp.tool()
    def suspend_vm(name: str, save: bool = True) -> dict:
        """Suspend a running VM to memory.
    
        Args:
            name: VM name (must be running)
            save: Save VM state to disk for later resume (default: True)
        """
        status = utm.suspend_vm(name, save=save)
        return {"name": name, "status": status}
  • AppleScript helper function that validates the VM name, constructs and runs an AppleScript to suspend a VM in UTM (with or without saving state), and returns the VM status.
    def suspend_vm(name: str, save: bool = True) -> str:
        """Suspend a running VM to memory. Optionally save state to disk."""
        _validate_vm_name(name)
        saving = "with saving" if save else "without saving"
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            suspend vm {saving}
            return status of vm as text
        end tell
        '''
        return _run(script, timeout=60)
  • MCP server creation and registration — the @mcp.tool() decorator on suspend_vm registers it as an MCP tool named 'suspend_vm'.
    from . import applescript as utm
    
    mcp = FastMCP("utm")
  • Test confirming 'suspend_vm' is in the set of expected MCP tool names registered on the server.
    def test_expected_tools(self):
        names = {t.name for t in mcp._tool_manager.list_tools()}
        expected = {
            "list_vms", "get_vm", "clone_vm", "start_vm", "stop_vm", "delete_vm",
            "suspend_vm", "wait_for_vm", "get_vm_ip", "set_vm_network",
            "set_vm_resources", "rename_vm", "set_vm_display", "list_vm_shares",
            "add_vm_share", "remove_vm_share", "set_vm_shares", "list_vm_drives",
            "attach_drive", "export_vm", "import_vm", "get_serial_port",
        }
        assert expected == names
  • Unit tests for suspend_vm in applescript.py, verifying 'with saving' and 'without saving' are correctly passed in the AppleScript.
    @patch("mcp_utm.applescript._run")
    def test_suspend_with_save(self, mock_run):
        mock_run.return_value = "paused"
        suspend_vm("my-vm", save=True)
        assert "with saving" in mock_run.call_args[0][0]
    
    @patch("mcp_utm.applescript._run")
    def test_suspend_without_save(self, mock_run):
        mock_run.return_value = "paused"
        suspend_vm("my-vm", save=False)
        assert "without saving" in mock_run.call_args[0][0]
Behavior3/5

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

With no annotations provided, the description is the sole source of behavioral info. It discloses that the VM is suspended to memory and optionally saves state to disk (via the save parameter). However, it does not mention what happens after suspension (e.g., how to resume), required permissions, or side effects like network disconnection.

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 extremely concise with two sentences: the first states the action, and the second lists parameters with conditions. Every sentence is necessary and front-loaded, with no extraneous information.

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?

Given the tool's simplicity (2 parameters, no output schema, no annotations), the description covers the basic action and parameters. However, it lacks information about the result of the operation (e.g., return status), error conditions, or instructions for resuming, which would make it more complete for an agent.

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?

The input schema has 0% description coverage, so the description must compensate. It explains that 'name' must be a running VM and adds context for 'save' as saving state to disk for later resume. This adds meaningful semantics beyond the schema's type and default, though it could elaborate on the exact state saved.

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 uses a specific verb 'Suspend' and resource 'a running VM to memory', clearly indicating the action. It distinguishes from sibling tools like stop_vm (likely powers off) and start_vm by focusing on suspending to memory, making the purpose unambiguous.

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 states the prerequisite that the VM must be running, but provides no guidance on when to use this tool versus alternatives such as stop_vm or wait_for_vm. There is no explicit comparison or exclusions, leaving the agent without clear decision-making context.

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