Skip to main content
Glama

set_vm_display

Toggle dynamic resolution on a stopped VM's display to enable or disable adaptive screen scaling.

Instructions

Toggle dynamic resolution on the VM display.

Args: name: VM name (must be stopped) dynamic_resolution: Enable or disable dynamic resolution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
dynamic_resolutionYes

Implementation Reference

  • MCP tool handler function decorated with @mcp.tool() that exposes 'set_vm_display' to clients. It accepts a VM name and a boolean for dynamic resolution, delegates to the AppleScript layer, and returns the result dict.
    @mcp.tool()
    def set_vm_display(name: str, dynamic_resolution: bool) -> dict:
        """Toggle dynamic resolution on the VM display.
    
        Args:
            name: VM name (must be stopped)
            dynamic_resolution: Enable or disable dynamic resolution
        """
        utm.set_vm_display(name, dynamic_resolution)
        return {"name": name, "dynamic_resolution": dynamic_resolution}
  • Core AppleScript logic that toggles dynamic resolution on the first display of a stopped UTM VM. Validates the VM name, constructs an AppleScript snippet, and executes it via osascript.
    def set_vm_display(name: str, dynamic_resolution: bool) -> bool:
        """Toggle dynamic resolution on the first display of a stopped VM."""
        _validate_vm_name(name)
        val = "true" if dynamic_resolution else "false"
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            set conf to configuration of vm
            set disps to displays of conf
            if (count of disps) > 0 then
                set dynamic resolution of item 1 of disps to {val}
                update configuration of vm with conf
            end if
        end tell
        '''
        _run(script)
        return True
  • The @mcp.tool() decorator on line 275 registers 'set_vm_display' as an MCP tool. The function name (set_vm_display) becomes the tool name exposed by the MCP server.
    @mcp.tool()
  • Type signatures for the tool: name (str) and dynamic_resolution (bool). The return type is dict (inferred from -> dict annotation).
    def set_vm_display(name: str, dynamic_resolution: bool) -> dict:
  • Unit tests for set_vm_display: verifies that passing True/False injects the correct 'true'/'false' value into the generated AppleScript.
    class TestDisplay:
        @patch("mcp_utm.applescript._run")
        def test_enable_dynamic(self, mock_run):
            set_vm_display("my-vm", True)
            assert "true" in mock_run.call_args[0][0]
    
        @patch("mcp_utm.applescript._run")
        def test_disable_dynamic(self, mock_run):
            set_vm_display("my-vm", False)
            assert "false" in mock_run.call_args[0][0]
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only says 'Toggle' and the stopped requirement, but omits details on idempotency, side effects, or error behavior.

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?

The description is extremely concise: a one-line summary followed by a compact args list. Every sentence adds value with no waste.

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

Completeness3/5

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

While the description covers the tool's purpose, args, and a key condition (stopped VM), it lacks information on return values, failure modes, or idempotency, leaving some gaps for a simple toggle tool.

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 the description clearly explains both parameters: name as 'VM name (must be stopped)' and dynamic_resolution as 'Enable or disable dynamic resolution', adding value beyond type alone.

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 uses 'Toggle dynamic resolution on the VM display' which is a specific verb and resource, clearly distinguishing it from siblings that deal with network, resources, or 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 states 'VM must be stopped' as a prerequisite, but offers no guidance on when to use vs alternatives like set_vm_network or set_vm_resources, nor 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