get_host
Retrieves detailed information about a host, including hardware specs, hypervisor details, and resource usage, using the host UUID.
Instructions
Get detailed information about a specific host by UUID. Returns hardware specs, hypervisor info, and resource usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host_uuid | Yes | The UUID (extId) of the host |
Implementation Reference
- src/nutanix_mcp/tools/cluster.py:200-209 (handler)The actual handler function for the 'get_host' tool. It calls client.v4_get with namespace='clustermgmt' and path='config/hosts/{host_uuid}'. Returns the data from the Nutanix v4 API.
async def handle_get_host( client: NutanixClient, arguments: dict[str, Any] ) -> dict[str, Any]: """Get host details using v4 clustermgmt API.""" host_uuid = arguments["host_uuid"] result = await client.v4_get( namespace="clustermgmt", path=f"config/hosts/{host_uuid}", ) return result.get("data", result) - The input schema definition for the 'get_host' tool. It requires a 'host_uuid' string parameter and describes returning hardware specs, hypervisor info, and resource usage.
{ "name": "get_host", "description": ( "Get detailed information about a specific host by UUID. " "Returns hardware specs, hypervisor info, and resource usage." ), "inputSchema": { "type": "object", "properties": { "host_uuid": { "type": "string", "description": "The UUID (extId) of the host", }, }, "required": ["host_uuid"], }, }, - src/nutanix_mcp/tools/cluster.py:253-259 (registration)The CLUSTER_HANDLERS dispatch table mapping 'get_host' to handle_get_host. This dictionary is imported into server.py where all handlers are merged into ALL_HANDLERS.
CLUSTER_HANDLERS: dict[str, Any] = { "list_clusters": handle_list_clusters, "get_cluster": handle_get_cluster, "list_hosts": handle_list_hosts, "get_host": handle_get_host, "list_storage_containers": handle_list_storage_containers, } - src/nutanix_mcp/server.py:35-41 (registration)ALL_HANDLERS merges CLUSTER_HANDLERS (and other handler dicts). The server's call_tool handler looks up tool names in this dictionary to dispatch to the correct handler.
ALL_HANDLERS: dict[str, Any] = { **VM_HANDLERS, **CLUSTER_HANDLERS, **PE_HANDLERS, **REPORT_HANDLERS, **NETWORKING_HANDLERS, } - src/nutanix_mcp/client.py:90-132 (helper)The v4_get method on NutanixClient that handle_get_host calls. It constructs a GET request to the v4 API at /{namespace}/v4.0/{path} and returns the JSON response.
async def v4_get( self, namespace: str, path: str, params: Optional[dict[str, str]] = None, ) -> dict[str, Any]: """GET request against v4 API. Args: namespace: API namespace (e.g., 'vmm', 'clustermgmt', 'prism') path: Resource path (e.g., 'ahv/config/vms') params: Optional OData query parameters """ client = await self._get_client() url = f"/{namespace}/{self.V4_VERSION}/{path}" for attempt in range(self.MAX_RETRIES + 1): try: response = await client.get(url, params=params) except httpx.ConnectError as e: raise NutanixAPIError( f"Connection failed to {self.settings.host}:{self.settings.port}", details=str(e), ) except httpx.TimeoutException as e: raise NutanixAPIError( f"Request timed out after {self.settings.timeout}s", details=str(e), ) if response.status_code == 429 and attempt < self.MAX_RETRIES: wait = self.RETRY_BACKOFF_BASE * (2 ** attempt) await asyncio.sleep(wait) continue if response.status_code >= 400: self._handle_error(response) return response.json() # Should not reach here, but safety net self._handle_error(response) return {} # unreachable