Skip to main content
Glama

export_vm

Export a virtual machine to a .utm file for backup or transfer. Provide the VM name and destination path.

Instructions

Export a VM to a .utm file.

Args: name: VM name path: Destination file path (e.g. "/tmp/my-vm.utm")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathYes

Implementation Reference

  • The actual implementation of the export_vm function. Validates inputs, builds an AppleScript to export the VM using UTM's AppleScript API, runs it with a 600s timeout, and returns True on success.
    def export_vm(name: str, path: str) -> bool:
        """Export a VM to a .utm file at the given path."""
        _validate_vm_name(name)
        _validate_path(path)
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            set dest to POSIX file "{_esc(path)}"
            export vm to dest
        end tell
        '''
        _run(script, timeout=600)
        return True
  • MCP tool registration for export_vm. Decorated with @mcp.tool(), delegates to utm.export_vm() (from applescript.py) and returns a dict with the result.
    @mcp.tool()
    def export_vm(name: str, path: str) -> dict:
        """Export a VM to a .utm file.
    
        Args:
            name: VM name
            path: Destination file path (e.g. "/tmp/my-vm.utm")
        """
        utm.export_vm(name, path)
        return {"name": name, "exported_to": path}
  • Validation helper used by export_vm to ensure the path is absolute and doesn't contain path traversal.
    def _validate_path(path: str) -> str:
        if not path.startswith("/"):
            raise ValueError(f"Path must be absolute: {path!r}")
        if ".." in path.split("/"):
            raise ValueError(f"Path traversal not allowed: {path!r}")
        return path
  • Escape helper used by export_vm to safely interpolate strings into AppleScript double-quoted literals.
    def _esc(value: str) -> str:
        """Escape a string for safe interpolation into AppleScript double-quoted literals."""
        return value.replace("\\", "\\\\").replace('"', '\\"')
  • Validation helper used by export_vm to ensure the VM name is valid.
    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
Behavior2/5

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

No annotations provided, so the description carries full burden. It only states the basic action but does not disclose behavioral traits such as whether the VM must be stopped, file location constraints, or side effects.

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 very concise and front-loaded with the primary action. Every sentence earns its place with no redundancy.

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 no output schema, no annotations, and low parameter coverage, the description is incomplete. It lacks details on where the file is created, whether it's synchronous, and expected return values.

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 0%, so the description must compensate. It adds minimal value by providing an example path in the description for the 'path' parameter, but does not explain constraints or formatting beyond the 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 'Export a VM to a .utm file', which is a specific verb+resource. It distinguishes from sibling tools like clone_vm or delete_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 on when to use this tool vs alternatives, prerequisites, or conditions like VM state. The description only states the action without 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