Skip to main content
Glama

list_vm_drives

Lists all drives attached to a virtual machine, showing their IDs and sizes. Use this to inspect storage configuration of a specific VM.

Instructions

List drives attached to a VM with their IDs and sizes.

Args: name: VM name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of list_vm_drives: executes AppleScript to query UTM for drives attached to a VM, parses the output (id, removable, host_size_mib) into DriveInfo objects.
    def list_vm_drives(name: str) -> list[DriveInfo]:
        """List drives attached to a VM."""
        _validate_vm_name(name)
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            set conf to configuration of vm
            set drvs to drives of conf
            set output to ""
            repeat with d in drvs
                set dId to id of d
                set dRemovable to removable of d
                set dSize to host size of d
                set output to output & dId & "||" & dRemovable & "||" & dSize & linefeed
            end repeat
            return output
        end tell
        '''
        raw = _run(script)
        drives = []
        for line in raw.strip().split("\n"):
            line = line.strip()
            if not line:
                continue
            parts = line.split("||")
            if len(parts) >= 3:
                drives.append(DriveInfo(
                    id=parts[0],
                    removable=parts[1].lower() == "true",
                    host_size_mib=_parse_int(parts[2]),
                ))
        return drives
  • DriveInfo dataclass schema with id, removable, host_size_mib fields and to_dict() method.
    @dataclass
    class DriveInfo:
        id: str
        removable: bool
        host_size_mib: int
    
        def to_dict(self) -> dict:
            return {"id": self.id, "removable": self.removable, "host_size_mib": self.host_size_mib}
  • MCP tool registration via @mcp.tool() decorator - list_vm_drives delegates to applescript.list_vm_drives and converts results via to_dict().
    @mcp.tool()
    def list_vm_drives(name: str) -> list[dict]:
        """List drives attached to a VM with their IDs and sizes.
    
        Args:
            name: VM name
        """
        return [d.to_dict() for d in utm.list_vm_drives(name)]
  • Helper _esc() used for safe string escaping in AppleScript interpolation.
    def _esc(value: str) -> str:
        """Escape a string for safe interpolation into AppleScript double-quoted literals."""
        return value.replace("\\", "\\\\").replace('"', '\\"')
  • Helper _validate_vm_name() used to validate VM name before querying drives.
    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; description only states function. It does not explicitly disclose read-only nature or potential side effects, leaving the agent to infer safety from the verb 'list'.

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?

Description is extremely concise, with one sentence and an Args line. No wasted words, front-loaded with purpose.

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?

Given the simple single-parameter tool with an output schema, the description covers the essential purpose and parameter. Minor omission: no mention of error conditions or response structure, but output schema compensates.

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 has 0% description coverage (only title 'Name'), but the tool description adds 'VM name' for the parameter, providing meaningful context 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 the tool lists drives attached to a VM with IDs and sizes, using a specific verb and resource. It distinguishes from siblings like list_vms and attach_drive.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies use when needing drive information for a VM, but provides no explicit when-to-use or alternatives. No exclusions or context is given.

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