Skip to main content
Glama

vm_restore

Restore virtual machines or containers to specific snapshots in Incus environments. Use this tool to revert systems to previous states by specifying VM/container names and snapshot identifiers.

Instructions

Restore a VM/container to a named snapshot (Incus).

Args:
    vm: Name of the VM or container.
    snapshot: Name of the snapshot to restore.

Returns:
    Success confirmation or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vmYes
snapshotYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that wraps the core vm_restore implementation with error handling and response formatting. Decorated with @mcp.tool() for registration.
    @mcp.tool()
    async def vm_restore(vm: str, snapshot: str) -> str:
        """Restore a VM/container to a named snapshot (Incus).
    
        Args:
            vm: Name of the VM or container.
            snapshot: Name of the snapshot to restore.
    
        Returns:
            Success confirmation or error message.
        """
        try:
            result = await _vm_restore(vm, snapshot)
            if result.exit_code == 0:
                return f"Restored {vm} to snapshot '{snapshot}'"
            return f"ERROR restoring snapshot: {result.stderr.strip()}"
        except (ValueError, RuntimeError, OSError) as e:
            return f"ERROR: {e}"
  • Core implementation of vm_restore that validates inputs and executes the incus CLI command to restore a VM to a snapshot.
    async def vm_restore(vm: str, snapshot: str) -> ExecResult:
        """Restore a VM/container to a named snapshot.
    
        Uses `incus snapshot restore <vm> <snapshot>`.
        """
        _validate_vm_name(vm)
        _validate_snapshot_name(snapshot)
        return await _run_incus("snapshot", "restore", vm, snapshot)
  • Validation helper functions used by vm_restore to ensure VM and snapshot names are safe before executing the incus command.
    def _validate_vm_name(name: str) -> None:
        """Validate that a VM/container name is safe."""
        if not name or not name.strip():
            raise ValueError("VM name cannot be empty")
        if not _VALID_NAME.match(name):
            raise ValueError(
                f"Invalid VM name '{name}': must start with a letter, "
                "contain only alphanumeric characters and hyphens"
            )
    
    
    def _validate_snapshot_name(name: str) -> None:
        """Validate a snapshot name."""
        if not name or not name.strip():
            raise ValueError("Snapshot name cannot be empty")
        if not re.match(r"^[a-zA-Z0-9_\-]+$", name):
            raise ValueError(
                f"Invalid snapshot name '{name}': "
                "only alphanumeric, hyphens, and underscores allowed"
            )
  • Import statement that brings the core vm_restore implementation into the server module, aliased as _vm_restore to distinguish from the MCP handler.
    from sympathy_mcp.lifecycle import (
        VMInfo,
        vm_snapshot as _vm_snapshot,
        vm_restore as _vm_restore,
        vm_status as _vm_status,
        vm_list as _vm_list,
    )
Behavior2/5

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

With no annotations, the description carries full burden. It mentions 'Restore' implies a destructive write operation, but doesn't disclose critical behaviors: whether the restore is irreversible, if it stops/restarts the VM, permission requirements, or potential data loss. The return statement is vague ('Success confirmation or error message').

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 front-loaded with the core purpose, followed by structured Args and Returns sections. Every sentence earns its place: the first states what it does, the next two explain parameters, and the last covers returns. No wasted words.

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 a destructive operation with no annotations, 2 parameters (0% schema coverage), and an output schema (implied by 'Returns'), the description is minimally adequate. It covers purpose and parameters but lacks behavioral details (e.g., side effects, auth needs). The output schema existence reduces need to explain return values, but safety concerns are under-addressed.

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 description coverage is 0%, so the description must compensate. It clearly explains both parameters: 'vm' as 'Name of the VM or container' and 'snapshot' as 'Name of the snapshot to restore', adding meaningful context beyond the bare schema. However, it doesn't detail format constraints (e.g., naming rules).

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 ('Restore') and target ('a VM/container to a named snapshot'), specifying the technology context ('Incus'). It distinguishes from siblings like vm_snapshot (create) and vm_list (list), but doesn't explicitly contrast with other restore-related tools if any existed.

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 on when to use this tool versus alternatives is provided. While siblings include vm_snapshot (likely for creating snapshots) and others for file operations, the description doesn't mention prerequisites (e.g., snapshot must exist) or when to choose this over other VM management tools.

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/bobbyhiddn/Sympathy-MCP'

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