Skip to main content
Glama

rename_vm

Rename a stopped virtual machine managed by UTM on macOS by specifying the current name and the new name.

Instructions

Rename a stopped VM.

Args: name: Current VM name (must be stopped) new_name: New name for the VM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
new_nameYes

Implementation Reference

  • The MCP tool registration for 'rename_vm' using the @mcp.tool() decorator. It delegates to utm.rename_vm() and returns the config as a dict.
    @mcp.tool()
    def rename_vm(name: str, new_name: str) -> dict:
        """Rename a stopped VM.
    
        Args:
            name: Current VM name (must be stopped)
            new_name: New name for the VM
        """
        config = utm.rename_vm(name, new_name)
        return config.to_dict()
  • The core implementation of rename_vm. Validates both old and new names, constructs an AppleScript that updates the VM configuration's name, executes via osascript, then retrieves and returns the updated VM config.
    def rename_vm(name: str, new_name: str) -> VMConfig:
        """Rename a stopped VM via update configuration."""
        _validate_vm_name(name)
        _validate_vm_name(new_name)
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            set conf to configuration of vm
            set name of conf to "{_esc(new_name)}"
            update configuration of vm with conf
        end tell
        '''
        _run(script)
        return get_vm_config(new_name)
  • The _esc helper escapes backslashes and double-quotes for safe AppleScript string interpolation.
    def _esc(value: str) -> str:
        """Escape a string for safe interpolation into AppleScript double-quoted literals."""
        return value.replace("\\", "\\\\").replace('"', '\\"')
  • The _validate_vm_name helper used by rename_vm to check both old and new names against the allowed character pattern.
    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
  • The _run helper that executes AppleScript snippets via subprocess (osascript), used by rename_vm to apply the name change.
    def _run(script: str, timeout: int = 30) -> str:
        """Execute an AppleScript snippet and return stdout."""
        result = subprocess.run(
            ["osascript", "-e", script],
            capture_output=True,
            text=True,
            timeout=timeout,
        )
        if result.returncode != 0:
            err = result.stderr.strip()
            if "Application can" in err and "found" in err:
                raise RuntimeError("UTM is not running. Launch UTM and try again.")
            raise RuntimeError(err or f"osascript failed (rc={result.returncode})")
        return result.stdout.strip()
Behavior3/5

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

With no annotations, the description carries full burden. It discloses the core mutation (rename) and the prerequisite (stopped), but lacks details on permissions, side effects, or reversibility. For a simple rename operation, this is adequate but not rich.

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: one sentence and a two-line parameter list with no extraneous text. It is front-loaded with the key action and condition, making it highly efficient.

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

Completeness4/5

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

For a simple tool with no output schema, the description covers the essential: operation (rename), prerequisite (stopped), and parameters. It lacks mention of whether the rename is immediate or if the VM must exist, but the core requirements are clear.

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?

The input schema has 0% description coverage. The description adds minimal meaning: it labels each parameter with its purpose and notes the 'stopped' condition for 'name'. This adds value but does not specify constraints like length or allowed characters, leaving some ambiguity.

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 'Rename a stopped VM.' It uses a specific verb (rename) and resource (VM), and adds the prerequisite 'stopped', which distinguishes it from sibling tools like start_vm, stop_vm, clone_vm, etc.

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?

The description explicitly notes that the VM must be stopped, providing a clear condition for when to use the tool. However, it does not mention alternatives or explicitly state when not to use it, though the condition implies it.

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