Skip to main content
Glama

list_vm_shares

List all VirtioFS shared directories registered for a specific UTM virtual machine by providing its name.

Instructions

List shared directories (VirtioFS) registered for a VM.

Args: name: VM name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • MCP tool handler for list_vm_shares. Decorated with @mcp.tool(), it accepts a VM name and delegates to utm.list_vm_shares(name) (the applescript module), returning 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}
  • Core implementation of list_vm_shares. Validates the VM name, builds and executes an AppleScript that iterates over the VM's registry entries (shared directories), and returns a list of POSIX path 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()]
  • Import binding: the server module imports applescript as 'utm', and the @mcp.tool() decorator registers list_vm_shares as an MCP tool on line 221.
    from . import applescript as utm
  • Test confirms 'list_vm_shares' is listed among the expected registered MCP tool names.
    "set_vm_resources", "rename_vm", "set_vm_display", "list_vm_shares",
  • Tests for list_vm_shares and related share management functions, verifying AppleScript output parsing and empty-list handling.
    class TestShares:
        @patch("mcp_utm.applescript._run")
        def test_list_shares(self, mock_run):
            mock_run.return_value = "/Users/dev/.ssh/\n/tmp\n"
            shares = list_vm_shares("my-vm")
            assert shares == ["/Users/dev/.ssh/", "/tmp"]
    
        @patch("mcp_utm.applescript._run")
        def test_list_shares_empty(self, mock_run):
            mock_run.return_value = ""
            assert list_vm_shares("my-vm") == []
    
        @patch("mcp_utm.applescript.list_vm_shares")
        @patch("mcp_utm.applescript.set_vm_shares")
        def test_add_share_new(self, mock_set, mock_list):
            mock_list.return_value = ["/existing/"]
            mock_set.return_value = ["/existing/", "/new/path"]
            result = add_vm_share("my-vm", "/new/path")
            assert "/new/path" in result
    
        @patch("mcp_utm.applescript.list_vm_shares")
        def test_add_share_dedup(self, mock_list):
            mock_list.return_value = ["/existing/"]
            result = add_vm_share("my-vm", "/existing")
            assert result == ["/existing/"]
    
        @patch("mcp_utm.applescript.list_vm_shares")
        @patch("mcp_utm.applescript.set_vm_shares")
        def test_remove_share(self, mock_set, mock_list):
            mock_list.return_value = ["/Users/dev/.ssh/", "/tmp/"]
            mock_set.return_value = ["/Users/dev/.ssh/"]
            result = remove_vm_share("my-vm", "/tmp")
            mock_set.assert_called_once()
    
        @patch("mcp_utm.applescript.list_vm_shares")
        def test_remove_nonexistent(self, mock_list):
            mock_list.return_value = ["/existing/"]
            result = remove_vm_share("my-vm", "/not-there")
            assert result == ["/existing/"]
Behavior2/5

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

No annotations provided, and the description adds no behavioral traits such as whether the VM must exist, auth requirements, rate limits, or return format. The only hint is 'registered for a VM' but that is minimal.

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

Conciseness3/5

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

The description is very short with no redundant text, but it is underspecified rather than concise. The Args block adds minimal value, and the overall structure is acceptable but not efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with no output schema and one parameter, the description lacks context: no mention of output structure, VM existence requirement, or scope. It is incomplete for an agent to confidently invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate but only adds 'VM name' which trivially clarifies the parameter. No additional format, constraints, or examples are provided.

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 verb 'list' and the resource 'shared directories (VirtioFS) for a VM', distinguishing it from sibling tools like add_vm_share or set_vm_shares which modify shares, and other listing tools like list_vm_drives.

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 explicit guidance on when to use or when not; no mention of prerequisites like VM existence or alternative tools. The description only states the argument, leaving the agent to infer basic usage.

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