Skip to main content
Glama

add_vm_share

Add a host directory as a VirtioFS share on a UTM VM. The directory persists across boots and appears inside the guest at /Volumes/My Shared Files.

Instructions

Add a host directory as a VirtioFS share on a VM.

Creates a security-scoped bookmark so the share persists across boots and works with Apple VF clones. The directory appears inside the guest at /Volumes/My Shared Files/.

Args: name: VM name (must be stopped) path: Host directory path to share (e.g. "/Users/you/project")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathYes

Implementation Reference

  • MCP tool handler for 'add_vm_share'. Decorated with @mcp.tool(), it accepts VM name and host directory path, delegates to utm.add_vm_share(), and returns the updated share list.
    @mcp.tool()
    def add_vm_share(name: str, path: str) -> dict:
        """Add a host directory as a VirtioFS share on a VM.
    
        Creates a security-scoped bookmark so the share persists across boots
        and works with Apple VF clones. The directory appears inside the guest
        at /Volumes/My Shared Files/<folder-name>.
    
        Args:
            name: VM name (must be stopped)
            path: Host directory path to share (e.g. "/Users/you/project")
        """
        shares = utm.add_vm_share(name, path)
        return {"name": name, "shares": shares}
  • Core implementation of add_vm_share. Validates the path, lists current shares, deduplicates by normalized path, appends the new path, and calls set_vm_shares() to persist via AppleScript.
    def add_vm_share(name: str, path: str) -> list[str]:
        """Add a shared directory to a VM without removing existing shares."""
        _validate_path(path)
        current = list_vm_shares(name)
        normalized = path.rstrip("/")
        existing = [p.rstrip("/") for p in current]
        if normalized in existing:
            return current
        current.append(path)
        return set_vm_shares(name, current)
  • set_vm_shares() — the lower-level helper that constructs the AppleScript to update the UTM VM registry with the full list of share paths.
    def set_vm_shares(name: str, paths: list[str]) -> list[str]:
        """Replace all shared directories for a VM."""
        _validate_vm_name(name)
        for p in paths:
            _validate_path(p)
    
        if not paths:
            script = f'''
            tell application "UTM"
                set vm to virtual machine named "{_esc(name)}"
                update registry of vm with {{}}
            end tell
            '''
        else:
            share_items = ", ".join(f'POSIX file "{_esc(p)}"' for p in paths)
            script = f'''
            tell application "UTM"
                set vm to virtual machine named "{_esc(name)}"
                update registry of vm with {{{share_items}}}
            end tell
            '''
        _run(script)
        return list_vm_shares(name)
  • list_vm_shares() — helper used by add_vm_share to retrieve current shares from a VM via AppleScript.
    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()]
  • Tool registration: 'add_vm_share' is registered by the @mcp.tool() decorator on the handler function. mcp = FastMCP('utm') creates the server instance that manages tool registration.
    from . import applescript as utm
Behavior4/5

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

No annotations provided, but description discloses persistence via security-scoped bookmark, compatibility with Apple VF clones, and guest mount path. Lacks details on side effects or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is efficient, with main purpose upfront and Args section providing parameter details. Slightly longer than minimal but structured well.

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 two-parameter tool without output schema, description covers share type, persistence, mount point, and prerequisite. Minor gaps like duplicate share handling.

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 coverage is 0%, but description adds meaning: name is VM name (must be stopped), path is host directory with example. Compensates well for missing schema descriptions.

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?

Clearly states it adds a host directory as a VirtioFS share on a VM. Specifies persistence and mount point, distinguishing from siblings like remove_vm_share.

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?

Implies usage for adding a single persistent share, but no explicit guidance on when to use vs set_vm_shares or alternatives. The VM must be stopped is noted.

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