Skip to main content
Glama

remove_vm_share

Remove a shared directory from a stopped virtual machine by specifying the VM name and host directory path.

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

  • MCP tool handler for remove_vm_share. Registered as an @mcp.tool(), it delegates to utm.remove_vm_share() and returns the 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}
  • Core implementation of remove_vm_share. Lists current shares, normalizes the path by stripping trailing slash, filters out the matching path, and calls set_vm_shares to update. Returns the unchanged list if the path was not found.
    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)
  • Helper set_vm_shares called by remove_vm_share. Validates paths, constructs AppleScript to update the VM's registry with the new share list via osascript, and returns the refreshed share list.
    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)
  • Helper list_vm_shares called by remove_vm_share to fetch the current list of shared directories from the VM's registry 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()]
  • Registration of remove_vm_share as an MCP tool via the @mcp.tool() decorator on line 248.
    @mcp.tool()
    def remove_vm_share(name: str, path: str) -> dict:
Behavior3/5

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

Discloses that VM must be stopped, a behavioral constraint. No annotations present, so description carries burden; lacks details on side effects, permissions, or reversibility.

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?

Extremely concise: two-line description and a simple Args list. No redundant information.

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?

Covers purpose, parameters with constraints, and a prerequisite. Lacks return value or error info, but acceptable for a simple tool with no output schema.

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?

Adds meaning beyond schema by specifying 'name' must be stopped and 'path' is host directory path. Schema coverage is 0%, so description compensates.

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?

Description clearly states verb 'Remove', resource 'shared directory', and object 'from a VM'. Distinguishes from siblings like add_vm_share 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 Guidelines4/5

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

Provides a key prerequisite ('VM must be stopped'), but does not explicitly mention when to use vs alternatives or when not to use.

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