delete_vm
Permanently deletes a virtual machine. This action cannot be undone.
Instructions
Delete a VM permanently. Cannot be undone.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/mcp_utm/applescript.py:276-285 (handler)Core AppleScript handler that executes the 'delete virtual machine' command via osascript. Validates the VM name, runs the AppleScript, and returns True on success.
def delete_vm(name: str) -> bool: """Delete a VM. Returns True on success.""" _validate_vm_name(name) script = f''' tell application "UTM" delete virtual machine named "{_esc(name)}" end tell ''' _run(script, timeout=60) return True - src/mcp_utm/server.py:67-71 (registration)MCP tool registration for delete_vm. The @mcp.tool() decorator registers it, and the function delegates to utm.delete_vm(name) from applescript layer.
@mcp.tool() def delete_vm(name: str) -> dict: """Delete a VM permanently. Cannot be undone.""" utm.delete_vm(name) return {"name": name, "deleted": True} - src/mcp_utm/server.py:67-71 (schema)Input schema: accepts 'name' (str) parameter. Returns a dict with 'name' and 'deleted': True.
@mcp.tool() def delete_vm(name: str) -> dict: """Delete a VM permanently. Cannot be undone.""" utm.delete_vm(name) return {"name": name, "deleted": True} - src/mcp_utm/applescript.py:33-36 (helper)Helper function _validate_vm_name used by delete_vm to sanitize the VM name input.
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