Skip to main content
Glama

vm_list

List all available virtual machines and containers with their current status using Incus. This tool displays a formatted overview of all instances or indicates if none exist.

Instructions

List all available VMs and containers with their status (Incus).

Returns:
    Formatted list of all instances, or a message if none exist.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler registered with @mcp.tool() decorator. This function calls the lifecycle implementation and formats the VM list as a formatted string output.
    @mcp.tool()
    async def vm_list() -> str:
        """List all available VMs and containers with their status (Incus).
    
        Returns:
            Formatted list of all instances, or a message if none exist.
        """
        try:
            vms = await _vm_list()
            if not vms:
                return "No VMs or containers found."
    
            lines = [f"{'Name':<20} {'Status':<12} {'Type':<18} {'IPv4':<16}"]
            lines.append("-" * 66)
            for vm in vms:
                lines.append(
                    f"{vm.name:<20} {vm.status:<12} {vm.type:<18} {vm.ipv4:<16}"
                )
            return "\n".join(lines)
        except (RuntimeError, OSError) as e:
            return f"ERROR: {e}"
  • The core implementation that runs 'incus list --format json', parses the JSON output, and extracts VM information including name, status, type, and IPv4 addresses.
    async def vm_list() -> list[VMInfo]:
        """List all VMs/containers with status.
    
        Uses `incus list --format json`.
        """
        result = await _run_incus("list", "--format", "json")
        if result.exit_code != 0:
            raise RuntimeError(
                f"Failed to list VMs: {result.stderr.strip()}"
            )
    
        try:
            instances = json.loads(result.stdout)
        except json.JSONDecodeError as e:
            raise RuntimeError(f"Failed to parse incus output: {e}")
    
        vms: list[VMInfo] = []
        for inst in instances:
            ipv4 = ""
            state = inst.get("state", {})
            networks = state.get("network", {})
            for iface_name, iface in networks.items():
                if iface_name == "lo":
                    continue
                for addr in iface.get("addresses", []):
                    if addr.get("family") == "inet" and addr.get("scope") == "global":
                        ipv4 = ipv4 or addr.get("address", "")
    
            vms.append(VMInfo(
                name=inst.get("name", ""),
                status=inst.get("status", "Unknown"),
                type=inst.get("type", "unknown"),
                ipv4=ipv4,
            ))
    
        return vms
  • Dataclass schema defining the VMInfo structure with fields for name, status, type, IPv4/IPv6 addresses, architecture, and resource usage statistics.
    @dataclass
    class VMInfo:
        """Status information for a single VM/container."""
    
        name: str
        status: str  # Running, Stopped, etc.
        type: str  # container or virtual-machine
        ipv4: str = ""
        ipv6: str = ""
        architecture: str = ""
        pid: int = 0
        processes: int = 0
        memory_usage: int = 0
        cpu_usage: int = 0
        snapshots: list[str] = field(default_factory=list)
  • Import statement that imports vm_list from lifecycle module as _vm_list, making the core implementation available to the MCP tool handler.
    vm_list as _vm_list,
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior by stating it returns a formatted list or message if none exist, which is useful. However, it doesn't mention potential limitations like rate limits, authentication needs, or whether the list includes detailed metadata beyond status.

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 with two sentences: one stating the purpose and one explaining the return behavior. Every sentence adds value, and it's front-loaded with the core functionality. No wasted words or redundancy.

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?

Given the tool's simplicity (0 parameters, no annotations, but has output schema), the description is mostly complete. It explains what the tool does and the return format. However, it could benefit from slightly more behavioral context (e.g., how the list is formatted or if it's real-time), though the output schema may cover return values.

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 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose. Baseline is 4 for zero parameters, as it avoids unnecessary information.

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 specific action ('List all available VMs and containers') and resource ('VMs and containers'), and distinguishes from siblings by focusing on comprehensive listing rather than operations on specific instances. The mention of 'with their status (Incus)' adds technical specificity.

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 implies usage context by specifying it lists 'all available VMs and containers' with status, suggesting it's for inventory/overview purposes. However, it doesn't explicitly state when to use this vs. alternatives like vm_status (which likely checks a single VM) or provide explicit exclusions.

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/bobbyhiddn/Sympathy-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server