list_clusters
Retrieve a list of Nutanix clusters from Prism Central, including names, UUIDs, versions, and health status.
Instructions
List all Nutanix clusters registered with Prism Central. Returns cluster names, UUIDs, versions, and health status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | OData filter expression. Example: "name eq 'prod-cluster'" |
Implementation Reference
- src/nutanix_mcp/tools/cluster.py:110-136 (handler)The main handler function for the 'list_clusters' tool. Calls the Nutanix v4 clustermgmt API (config/clusters) and returns a structured response with cluster names, UUIDs, function, hypervisor types, operation mode, and redundancy factor.
async def handle_list_clusters( client: NutanixClient, arguments: dict[str, Any] ) -> dict[str, Any]: """List clusters using v4 clustermgmt API.""" filter_expr = arguments.get("filter") result = await client.v4_list_all( namespace="clustermgmt", path="config/clusters", filter=filter_expr, ) clusters = result.get("data", []) return { "count": len(clusters), "clusters": [ { "name": c.get("name"), "extId": c.get("extId"), "clusterFunction": c.get("config", {}).get("clusterFunction"), "hypervisorTypes": c.get("config", {}).get("hypervisorTypes"), "operationMode": c.get("config", {}).get("operationMode"), "redundancyFactor": c.get("config", {}).get("redundancyFactor"), } for c in clusters ], } - Tool definition with the name 'list_clusters', description, and input schema (accepts an optional 'filter' string for OData filtering).
CLUSTER_TOOLS: list[dict] = [ { "name": "list_clusters", "description": ( "List all Nutanix clusters registered with Prism Central. " "Returns cluster names, UUIDs, versions, and health status." ), "inputSchema": { "type": "object", "properties": { "filter": { "type": "string", "description": "OData filter expression. Example: \"name eq 'prod-cluster'\"", }, }, }, }, - src/nutanix_mcp/tools/cluster.py:253-254 (registration)Handler dispatch mapping: maps the string 'list_clusters' to the handle_list_clusters function.
CLUSTER_HANDLERS: dict[str, Any] = { "list_clusters": handle_list_clusters, - src/nutanix_mcp/server.py:34-41 (registration)ALL_HANDLERS merges CLUSTER_HANDLERS (which includes list_clusters) into the global dispatch table used by the call_tool endpoint.
# Merge all handler dispatch tables ALL_HANDLERS: dict[str, Any] = { **VM_HANDLERS, **CLUSTER_HANDLERS, **PE_HANDLERS, **REPORT_HANDLERS, **NETWORKING_HANDLERS, } - src/nutanix_mcp/tools/__init__.py:10-12 (registration)get_all_tools() aggregates CLUSTER_TOOLS (containing the list_clusters definition) with other tool definitions for registration in 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