Skip to main content
Glama
jkmills

Nutanix MCP Server

by jkmills

list_vms

List Nutanix virtual machines with their names, UUIDs, power states, and resource allocation. Supports OData filtering to narrow results.

Instructions

List virtual machines on Nutanix. Returns VM names, UUIDs, power states, and resource allocation. Supports OData filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoOData filter expression. Examples: "name eq 'my-vm'", "powerState eq 'ON'"
limitNoMaximum number of VMs to return. Omit to retrieve all (auto-paginates).

Implementation Reference

  • The async handler function that executes the 'list_vms' tool logic. Calls client.v4_list_all with namespace='vmm' and path='ahv/config/vms', then normalizes the response into a list of VMs with name, extId, powerState, vCPU count, memory, and cluster info.
    async def handle_list_vms(
        client: NutanixClient, arguments: dict[str, Any]
    ) -> dict[str, Any]:
        """List VMs using v4 vmm API."""
        filter_expr = arguments.get("filter")
        limit = arguments.get("limit")
    
        result = await client.v4_list_all(
            namespace="vmm",
            path="ahv/config/vms",
            filter=filter_expr,
            max_results=limit,
        )
    
        # Normalize response
        vms = result.get("data", [])
        metadata = result.get("metadata", {})
        return {
            "count": len(vms),
            "truncated": metadata.get("truncated", False),
            "vms": [
                {
                    "name": vm.get("name"),
                    "extId": vm.get("extId"),
                    "powerState": vm.get("powerState"),
                    "numVcpus": vm.get("numSockets", 0) * vm.get("numCoresPerSocket", 0),
                    "memorySizeMb": vm.get("memorySizeBytes", 0) // (1024 * 1024),
                    "cluster": vm.get("cluster", {}).get("extId"),
                }
                for vm in vms
            ],
        }
  • The tool definition/schema for 'list_vms' in the VM_TOOLS list. Defines input parameters: 'filter' (optional OData string) and 'limit' (optional integer).
    VM_TOOLS: list[dict] = [
        {
            "name": "list_vms",
            "description": (
                "List virtual machines on Nutanix. Returns VM names, UUIDs, power states, "
                "and resource allocation. Supports OData filtering."
            ),
            "inputSchema": {
                "type": "object",
                "properties": {
                    "filter": {
                        "type": "string",
                        "description": (
                            "OData filter expression. Examples: "
                            "\"name eq 'my-vm'\", \"powerState eq 'ON'\""
                        ),
                    },
                    "limit": {
                        "type": "integer",
                        "description": "Maximum number of VMs to return. Omit to retrieve all (auto-paginates).",
                    },
                },
            },
        },
  • The handler dispatch table that maps the string 'list_vms' to the handle_list_vms function.
    VM_HANDLERS: dict[str, Any] = {
        "list_vms": handle_list_vms,
  • The MCP server's call_tool handler that looks up the tool name in ALL_HANDLERS (which includes VM_HANDLERS) and dispatches to the matching handler function.
    @server.call_tool()
    async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]:
        """Execute a tool and return the result."""
        handler = ALL_HANDLERS.get(name)
        if not handler:
            return [TextContent(
                type="text",
                text=f"Error: Unknown tool '{name}'",
            )]
    
        try:
            result = await handler(client, arguments or {})
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • The get_all_tools() function that aggregates VM_TOOLS (containing the 'list_vms' tool definition) with other tool definitions for registration with the MCP server.
    def get_all_tools() -> list[dict]:
        """Return all registered tool definitions."""
        return VM_TOOLS + CLUSTER_TOOLS + PE_TOOLS + REPORT_TOOLS + NETWORKING_TOOLS
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses that the tool returns specific VM attributes, supports OData filtering, and auto-paginates when limit is omitted. It does not mention authentication or performance implications, but is informative enough for safe usage.

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?

Three efficient sentences: purpose, returned data, filtering capability. No fluff, each sentence earns its place. Well-structured for quick reading.

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 list tool with no output schema, the description adequately lists return fields. It covers both parameters' behaviors (filter, limit) and mentions auto-pagination. While it could detail output format more, it is sufficient for an agent to invoke correctly.

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 100%, baseline 3. The description adds value by explaining the 'limit' parameter's default behavior ('Omit to retrieve all') and giving OData filter examples, enhancing the schema's descriptions.

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 tool's action ('List virtual machines on Nutanix') and specifies return fields (VM names, UUIDs, power states, resource allocation). It distinguishes itself from sibling tools like create_vm or get_vm by focusing on listing multiple VMs with optional filtering.

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 mentions OData filtering support with examples, but does not explicitly state when to use this tool versus alternatives like get_vm for a single VM or pe_list_vms for a different endpoint. However, it provides clear context on OData usage and limit behavior.

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/jkmills/nutanix-mcp-server'

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