list_vm_shares
List all VirtioFS shared directories configured for a specified virtual machine, providing an overview of active file system mounts.
Instructions
List shared directories (VirtioFS) registered for a VM.
Args: name: VM name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/mcp_utm/server.py:221-229 (handler)MCP tool handler for 'list_vm_shares'. Decorated with @mcp.tool(), calls utm.list_vm_shares(name) and returns a dict with 'name' and 'shares'.
@mcp.tool() def list_vm_shares(name: str) -> dict: """List shared directories (VirtioFS) registered for a VM. Args: name: VM name """ shares = utm.list_vm_shares(name) return {"name": name, "shares": shares} - src/mcp_utm/applescript.py:580-595 (helper)Core AppleScript implementation of list_vm_shares. Builds an AppleScript that iterates over UTM's VM registry (shared directories), extracting POSIX paths, and returns them as a list of strings.
def list_vm_shares(name: str) -> list[str]: """List shared directories registered for a VM. Returns POSIX paths.""" _validate_vm_name(name) script = f''' tell application "UTM" set vm to virtual machine named "{_esc(name)}" set shares to registry of vm set output to "" repeat with s in shares set output to output & (POSIX path of s) & linefeed end repeat return output end tell ''' raw = _run(script) return [p.strip() for p in raw.strip().split("\n") if p.strip()] - src/mcp_utm/server.py:221-229 (registration)The @mcp.tool() decorator on list_vm_shares registers it with the FastMCP server as a tool named 'list_vm_shares'.
@mcp.tool() def list_vm_shares(name: str) -> dict: """List shared directories (VirtioFS) registered for a VM. Args: name: VM name """ shares = utm.list_vm_shares(name) return {"name": name, "shares": shares} - src/mcp_utm/server.py:221-229 (schema)The function signature (name: str) -> dict defines the input/output schema: accepts a VM name string, returns a dict with name and shares list.
@mcp.tool() def list_vm_shares(name: str) -> dict: """List shared directories (VirtioFS) registered for a VM. Args: name: VM name """ shares = utm.list_vm_shares(name) return {"name": name, "shares": shares}