power_on
Start a powered-off Hetzner Cloud server by providing its server ID to resume operations and services.
Instructions
Power on a server.
Powers on a server that is currently powered off.
Example:
- Power on server: {"server_id": 12345}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- mcp_hetzner/server.py:527-558 (handler)The main handler function for the 'power_on' tool. It retrieves the server by ID and calls the Hetzner Cloud API's power_on method via the hcloud client, returning the action details.@mcp.tool() def power_on(params: ServerIdParam) -> Dict[str, Any]: """ Power on a server. Powers on a server that is currently powered off. Example: - Power on server: {"server_id": 12345} """ try: server = client.servers.get_by_id(params.server_id) if not server: return {"error": f"Server with ID {params.server_id} not found"} action = client.servers.power_on(server) # Don't wait for the action to complete - the method doesn't exist return { "success": True, "action": { "id": action.id, "status": action.status, "command": action.command, "progress": action.progress, "error": action.error, "started": action.started.isoformat() if action.started else None, "finished": action.finished.isoformat() if action.finished else None, } if action else None, } except Exception as e: return {"error": f"Failed to power on server: {str(e)}"}
- mcp_hetzner/server.py:169-170 (schema)Pydantic BaseModel defining the input schema for the power_on tool, requiring a server_id integer.class ServerIdParam(BaseModel): server_id: int = Field(..., description="The ID of the server")
- mcp_hetzner/server.py:527-527 (registration)The @mcp.tool() decorator registers the power_on function as an MCP tool.@mcp.tool()