get_vm
Retrieve detailed configuration of a virtual machine by its UUID, including CPU, memory, disks, and NICs.
Instructions
Get detailed information about a specific VM by its UUID. Returns full configuration including CPU, memory, disks, and NICs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vm_uuid | Yes | The UUID (extId) of the virtual machine |
Implementation Reference
- src/nutanix_mcp/tools/vm.py:160-169 (handler)The handle_get_vm function is the core handler for the 'get_vm' tool. It extracts vm_uuid from arguments, calls client.v4_get() to fetch VM details via the Nutanix v4 vmm API at path 'ahv/config/vms/{vm_uuid}', and returns the response data.
async def handle_get_vm( client: NutanixClient, arguments: dict[str, Any] ) -> dict[str, Any]: """Get VM details using v4 vmm API.""" vm_uuid = arguments["vm_uuid"] result = await client.v4_get( namespace="vmm", path=f"ahv/config/vms/{vm_uuid}", ) return result.get("data", result) - src/nutanix_mcp/tools/vm.py:33-49 (schema)The schema/input definition for the 'get_vm' tool. Declares the tool name, description, and inputSchema requiring a 'vm_uuid' string property.
{ "name": "get_vm", "description": ( "Get detailed information about a specific VM by its UUID. " "Returns full configuration including CPU, memory, disks, and NICs." ), "inputSchema": { "type": "object", "properties": { "vm_uuid": { "type": "string", "description": "The UUID (extId) of the virtual machine", }, }, "required": ["vm_uuid"], }, }, - src/nutanix_mcp/tools/vm.py:240-246 (registration)The VM_HANDLERS dispatch table maps 'get_vm' string to handle_get_vm. This is merged into ALL_HANDLERS in server.py.
VM_HANDLERS: dict[str, Any] = { "list_vms": handle_list_vms, "get_vm": handle_get_vm, "power_on_vm": handle_power_on_vm, "power_off_vm": handle_power_off_vm, "create_vm": handle_create_vm, } - src/nutanix_mcp/server.py:34-41 (registration)ALL_HANDLERS merges VM_HANDLERS (which includes get_vm) into the global dispatch table used by the call_tool handler.
# Merge all handler dispatch tables ALL_HANDLERS: dict[str, Any] = { **VM_HANDLERS, **CLUSTER_HANDLERS, **PE_HANDLERS, **REPORT_HANDLERS, **NETWORKING_HANDLERS, } - src/nutanix_mcp/server.py:64-83 (registration)The call_tool decorator on the MCP server. Looks up the handler by name in ALL_HANDLERS and invokes it with the client and arguments, enabling dispatching to handle_get_vm when 'get_vm' is called.
@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))] except NutanixAPIError as e: error_text = f"Error: {e.message}" if e.status_code: error_text += f" (HTTP {e.status_code})" return [TextContent(type="text", text=error_text)] except Exception: return [TextContent(type="text", text="An unexpected error occurred")]