Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

detach_volume

Detach a volume from a Hetzner Cloud server to disconnect storage resources and manage server configurations.

Instructions

Detach a volume from a server. Detaches a volume from the server it's currently attached to. Example: - Detach volume: {"volume_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The handler function for detach_volume tool. Retrieves the volume by ID, checks if attached, calls client.volumes.detach(), and returns action status.
    @mcp.tool() def detach_volume(params: VolumeIdParam) -> Dict[str, Any]: """ Detach a volume from a server. Detaches a volume from the server it's currently attached to. Example: - Detach volume: {"volume_id": 12345} """ try: volume = client.volumes.get_by_id(params.volume_id) if not volume: return {"error": f"Volume with ID {params.volume_id} not found"} if not volume.server: return {"error": f"Volume with ID {params.volume_id} is not attached to any server"} action = client.volumes.detach(volume) # Format the response 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 detach volume: {str(e)}"}
  • Pydantic input schema for detach_volume (and other volume tools), requiring the volume_id integer.
    class VolumeIdParam(BaseModel): volume_id: int = Field(..., description="The ID of the volume")

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