delete_volume
Permanently delete a Hetzner Cloud volume by its ID to remove storage resources and manage cloud infrastructure.
Instructions
Delete a volume.
Permanently deletes a volume identified by its ID.
Example:
- Delete volume: {"volume_id": 12345}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- mcp_hetzner/server.py:1070-1089 (handler)The handler function for the 'delete_volume' tool. It takes a VolumeIdParam, retrieves the volume using the Hetzner client, and deletes it if found.def delete_volume(params: VolumeIdParam) -> Dict[str, Any]: """ Delete a volume. Permanently deletes a volume identified by its ID. Example: - Delete 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"} success = client.volumes.delete(volume) return {"success": success} except Exception as e: return {"error": f"Failed to delete volume: {str(e)}"}
- mcp_hetzner/server.py:215-216 (schema)Pydantic schema/model defining the input parameter 'volume_id' required by the delete_volume tool and other volume-related tools.class VolumeIdParam(BaseModel): volume_id: int = Field(..., description="The ID of the volume")
- mcp_hetzner/server.py:1070-1070 (registration)The @mcp.tool() decorator registers the delete_volume function as an MCP tool.def delete_volume(params: VolumeIdParam) -> Dict[str, Any]: