Skip to main content
Glama

remove_vm_share

Remove a shared directory from a stopped VM by specifying the host directory path. Use this to clean up shared folders.

Instructions

Remove a shared directory from a VM.

Args: name: VM name (must be stopped) path: Host directory path to remove

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathYes

Implementation Reference

  • Core handler: removes a shared directory from a VM by listing current shares, filtering out the matching path (normalized by stripping trailing slash), and calling set_vm_shares. If the path is not found, returns the current list unchanged.
    def remove_vm_share(name: str, path: str) -> list[str]:
        """Remove a shared directory from a VM."""
        current = list_vm_shares(name)
        normalized = path.rstrip("/")
        updated = [p for p in current if p.rstrip("/") != normalized]
        if len(updated) == len(current):
            return current
        return set_vm_shares(name, updated)
  • MCP tool registration via @mcp.tool() decorator. The server function delegates to applescript.remove_vm_share and returns the VM name and updated share list.
    @mcp.tool()
    def remove_vm_share(name: str, path: str) -> dict:
        """Remove a shared directory from a VM.
    
        Args:
            name: VM name (must be stopped)
            path: Host directory path to remove
        """
        shares = utm.remove_vm_share(name, path)
        return {"name": name, "shares": shares}
  • Helper function set_vm_shares - used by remove_vm_share to apply the updated share list via AppleScript. It validates paths and calls UTM's 'update registry' AppleScript API.
    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)
Behavior3/5

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

No annotations are provided, so the description must disclose behavior. It mentions the destructive nature (removal) and the prerequisite of VM being stopped, but lacks details on side effects, return values, 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?

The description is concise, with a clear one-line purpose followed by parameter details. It is well-structured and avoids unnecessary words, though could be slightly more streamlined.

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 with no output schema, the description covers the essential purpose and constraint. It lacks details on behavior when VM is running or return values, but is reasonably complete given the tool's simplicity.

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?

With 0% schema description coverage, the description adds meaning by explaining both parameters: 'name' is VM name with constraint 'must be stopped', and 'path' is the host directory path. This compensates for the schema gap.

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 action 'Remove a shared directory from a VM' using a specific verb and resource, distinguishing it from sibling tools like add_vm_share, list_vm_shares, and set_vm_shares.

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?

The description includes a usage prerequisite ('VM must be stopped') but lacks explicit guidance on when to use this tool versus alternatives or when not to use it.

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