Skip to main content
Glama

set_vm_resources

Update memory and CPU cores of a stopped virtual machine. Specify new values or keep current settings.

Instructions

Update memory and CPU cores of a stopped VM.

Args: name: VM name (must be stopped) memory: Memory in MiB, or None to keep current cpu_cores: Number of CPU cores, or None to keep current

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
memoryNo
cpu_coresNo

Implementation Reference

  • Core handler function that updates memory and/or CPU cores of a stopped UTM VM via AppleScript. Validates inputs, builds AppleScript commands, runs them, and returns updated config.
    def set_vm_resources(name: str, memory: int | None = None, cpu_cores: int | None = None) -> VMConfig:
        """Update memory and/or CPU cores of a stopped VM."""
        _validate_vm_name(name)
        parts = []
        if memory is not None:
            memory = int(memory)
            if memory < 64 or memory > _MAX_MEMORY_MIB:
                raise ValueError(f"Memory must be 64–{_MAX_MEMORY_MIB} MiB, got {memory}")
            parts.append(f"set memory of conf to {memory}")
        if cpu_cores is not None:
            cpu_cores = int(cpu_cores)
            if cpu_cores < 1 or cpu_cores > _MAX_CPU_CORES:
                raise ValueError(f"CPU cores must be 1–{_MAX_CPU_CORES}, got {cpu_cores}")
            parts.append(f"set cpu cores of conf to {cpu_cores}")
        if not parts:
            return get_vm_config(name)
    
        updates = "\n            ".join(parts)
        script = f'''
        tell application "UTM"
            set vm to virtual machine named "{_esc(name)}"
            set conf to configuration of vm
            {updates}
            update configuration of vm with conf
        end tell
        '''
        _run(script)
        return get_vm_config(name)
  • Constants used for validation in set_vm_resources: max memory (1 TiB) and max CPU cores (256).
    _MAX_TIMEOUT = 600  # seconds
    _MAX_MEMORY_MIB = 1048576  # 1 TiB
  • MCP tool registration decorating set_vm_resources as a FastMCP tool, delegating to applescript.set_vm_resources.
    @mcp.tool()
    def set_vm_resources(
        name: str,
        memory: int | None = None,
        cpu_cores: int | None = None,
    ) -> dict:
        """Update memory and CPU cores of a stopped VM.
    
        Args:
            name: VM name (must be stopped)
            memory: Memory in MiB, or None to keep current
            cpu_cores: Number of CPU cores, or None to keep current
        """
        config = utm.set_vm_resources(name, memory=memory, cpu_cores=cpu_cores)
        return config.to_dict()
Behavior3/5

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

No annotations are provided, so the description must bear the full burden. It adds the important constraint that the VM must be stopped. However, it does not disclose other behavioral aspects such as what happens if the VM is running, whether a reboot is required, or any error conditions. This is adequate but not comprehensive.

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 very concise: a single sentence followed by a clear Args section with three items. Every sentence adds value, and the structure is optimal for quick parsing.

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 tool with 3 parameters and no output schema, the description covers the essential aspects: action, precondition (stopped VM), and parameter semantics. However, it lacks information on return values, validation ranges, or error handling, which would improve completeness.

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?

The input schema has 0% description coverage, so the description must compensate. It explains each parameter: 'name: VM name', 'memory: Memory in MiB', 'cpu_cores: Number of CPU cores', and clarifies the 'None' default behavior. This adds significant value beyond the raw schema.

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 'Update memory and CPU cores of a stopped VM.' It identifies the specific resource (memory and CPU cores) and distinguishes from sibling tools like set_vm_display or set_vm_network.

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?

The description specifies that the VM must be stopped, providing a clear prerequisite. It also explains the optional parameters with None to keep current values. However, it does not explicitly compare with other VM modification tools or provide when-not-to-use guidance.

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