Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

power_off

Immediately power off a Hetzner Cloud server by cutting power, useful for emergency shutdowns or hardware resets. Note: This action may cause data loss.

Instructions

Power off a server.

Powers off a server. Note: This is equivalent to pulling the power plug and may cause data loss.
Consider using a graceful shutdown if possible.

Example:
- Power off server: {"server_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Handler function for the 'power_off' tool. Retrieves the server by ID and calls client.servers.power_off(server) to power off the Hetzner Cloud server, returning success and action details.
    def power_off(params: ServerIdParam) -> Dict[str, Any]:
        """
        Power off a server.
        
        Powers off a server. Note: This is equivalent to pulling the power plug and may cause data loss.
        Consider using a graceful shutdown if possible.
        
        Example:
        - Power off 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_off(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 off server: {str(e)}"}
  • Pydantic model defining the input schema for the power_off tool, requiring a server_id integer.
    class ServerIdParam(BaseModel):
        server_id: int = Field(..., description="The ID of the server")

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/dkruyt/mcp-hetzner'

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