Skip to main content
Glama
yeahdongcn

VMware Fusion MCP Server

by yeahdongcn

power_vm

Control VMware Fusion virtual machine power states by turning them on, off, shutting down, suspending, pausing, or unpausing operations.

Instructions

Perform a power action on a VM. Valid actions are 'on', 'off', 'shutdown', 'suspend', 'pause', 'unpause'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vm_idYes
actionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler logic for the power_vm tool: instantiates a VMwareClient using environment credentials and delegates to its power_vm method to execute the power action.
    async def _power_vm_impl(vm_id: str, action: str) -> Dict[str, Any]:
        """Perform a power action on a VM. Valid actions are 'on', 'off', 'shutdown', 'suspend', 'pause', 'unpause'."""
        async with VMwareClient(username=VMREST_USER, password=VMREST_PASS) as client:
            result = await client.power_vm(vm_id, action)
            return result  # type: ignore[no-any-return]
  • Registers the power_vm tool in the FastMCP server with input parameters vm_id and action, and docstring describing usage.
    @mcp.tool
    async def power_vm(vm_id: str, action: str) -> Dict[str, Any]:
        """Perform a power action on a VM. Valid actions are 'on', 'off', 'shutdown', 'suspend', 'pause', 'unpause'."""
        return await _power_vm_impl(vm_id, action)
  • Key helper method in VMwareClient that implements the power operation: validates the action, constructs and sends a PUT request to the Fusion REST API endpoint /api/vms/{vm_id}/power, handles authentication, parameters, responses, and errors.
    async def power_vm(
        self, vm_id: str, action: str, vm_password: Optional[str] = None
    ) -> Dict[str, Any]:
        """Perform a power action on a VM.
    
        Args:
            vm_id: The ID of the VM
            action: Power action (on, off, shutdown, suspend, pause, unpause)
            vm_password: The password for the VM (if required)
    
        Returns:
            Dictionary with the result of the power action
        """
        valid_actions = ["on", "off", "shutdown", "suspend", "pause", "unpause"]
        if action not in valid_actions:
            raise ValueError(
                f"Invalid action '{action}'. Valid actions: {valid_actions}"
            )
    
        try:
            url = f"{self.base_url}/api/vms/{vm_id}/power"
            params = {}
            if vm_password:
                params["vmPassword"] = vm_password
            headers = self._auth_header.copy()
            headers["Content-Type"] = "application/vnd.vmware.vmw.rest-v1+json"
            response = await self._client.put(
                url,
                headers=headers,
                params=params or None,
                content=action.encode(),
            )
            response.raise_for_status()
            return (
                response.json()
                if response.content
                else {"status": "success", "action": action}
            )
        except httpx.RequestError as e:
            raise Exception(f"Failed to connect to VMware Fusion API: {e}")
        except httpx.HTTPStatusError as e:
            if e.response.status_code == 404:
                raise Exception(f"VM with ID '{vm_id}' not found")
            raise Exception(
                f"VMware Fusion API error: {e.response.status_code} - "
                f"{e.response.text}"
            )
  • Input schema validation for the action parameter, enforcing allowed power actions.
    valid_actions = ["on", "off", "shutdown", "suspend", "pause", "unpause"]
    if action not in valid_actions:
        raise ValueError(
            f"Invalid action '{action}'. Valid actions: {valid_actions}"
        )
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what actions are valid. It doesn't disclose behavioral traits like whether actions are immediate or queued, permission requirements, whether 'shutdown' is graceful or forced, side effects on other VMs, or error handling. The description is minimal beyond stating valid actions.

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?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and follows with essential action details, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (power operations on VMs) and no annotations, the description is incomplete. It covers valid actions but lacks crucial context like permissions, side effects, or differences between actions. The presence of an output schema helps, but the description doesn't reference it or explain return values.

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?

The description adds significant value beyond the 0% schema coverage by explicitly listing all valid action values ('on', 'off', 'shutdown', 'suspend', 'pause', 'unpause'), which the schema doesn't document. However, it doesn't explain the 'vm_id' parameter or provide context about action differences.

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 verb ('perform a power action') and resource ('on a VM'), specifying the exact scope of operations. It distinguishes from sibling tools like 'get_vm_info' or 'list_vms' by focusing on power state changes rather than information retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for power state changes but doesn't explicitly state when to use this tool versus alternatives like 'get_vm_power_state' for checking status. It provides valid action values but no guidance on prerequisites, error conditions, or when certain actions are appropriate.

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/yeahdongcn/vmware-fusion-mcp-server'

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