Skip to main content
Glama

list_vm_drives

List drives attached to a virtual machine with their IDs and sizes for quick disk inventory and management.

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

  • MCP tool handler that lists drives attached to a VM. Decorated with @mcp.tool() and delegates to applescript.list_vm_drives.
    @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)]
  • Core implementation that executes AppleScript via osascript to query UTM for the VM's drive list, parsing the results 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
  • Data class representing a drive's information returned by list_vm_drives, with id, removable flag, and host size in MiB.
    @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}
  • Registration via @mcp.tool() decorator on the FastMCP instance. The function name becomes the tool name.
    @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)]
  • Validation helper called by list_vm_drives to sanitize VM name input before constructing AppleScript.
    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?

With no annotations, the description should disclose behavioral traits. It only states the action and output, omitting potential errors (e.g., VM not existing) or read-only guarantees.

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 two concise sentences plus an arg line, front-loading key information. No wasted words.

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 list tool, it specifies scope (attached drives) and output fields (IDs, sizes). The presence of an output schema likely covers return structure, so the description is reasonably complete.

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 coverage is 0%, so the description must compensate. It explains 'name' is the VM name, adding minimal meaning beyond the schema's type. No format or constraints are given.

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, specifying the output includes IDs and sizes. It distinguishes from sibling tools like 'attach_drive' and 'list_vms'.

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 is provided on when to use this tool versus alternatives. There is no mention of prerequisites or context for invocation.

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