list_vms
Retrieve a list of all virtual machines in VMware Fusion to monitor and manage your virtualization environment.
Instructions
List all VMs in VMware Fusion.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_vms"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- vmware_fusion_mcp/server.py:22-25 (handler)The MCP tool handler for 'list_vms', registered via @mcp.tool decorator. It calls the internal _list_vms_impl function to perform the listing.
@mcp.tool async def list_vms() -> Dict[str, Any]: """List all VMs in VMware Fusion.""" return await _list_vms_impl() - vmware_fusion_mcp/server.py:15-19 (helper)Helper function that creates a VMwareClient instance and calls list_vms() on it, wrapping the result in a dict.
async def _list_vms_impl() -> Dict[str, Any]: """List all VMs in VMware Fusion.""" async with VMwareClient(username=VMREST_USER, password=VMREST_PASS) as client: vms = await client.list_vms() return {"vms": vms} # type: ignore[no-any-return] - Core implementation in VMwareClient that makes an HTTP GET request to /api/vms endpoint to fetch the list of VMs from Fusion REST API.
async def list_vms(self) -> List[Dict[str, Any]]: """List all VMs. Returns: List of VM dictionaries with basic information """ try: response = await self._client.get( f"{self.base_url}/api/vms", headers=self._auth_header, ) response.raise_for_status() result: List[Dict[str, Any]] = response.json() return result except httpx.RequestError as e: raise Exception(f"Failed to connect to VMware Fusion API: {e}") except httpx.HTTPStatusError as e: raise Exception( f"VMware Fusion API error: {e.response.status_code} - " f"{e.response.text}" )