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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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")
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action is 'detach' which implies a destructive/mutative operation, but doesn't disclose behavioral traits like whether this requires specific permissions, if it's reversible, potential data loss, or rate limits. The example shows the parameter format but doesn't explain the outcome.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences plus an example. The first sentence states the purpose clearly, the second reinforces it, and the example provides concrete usage. No unnecessary information is included, though it could be more front-loaded with critical details.

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 1 parameter with 0% schema coverage and no annotations, the description is minimally complete for a simple destructive operation. The presence of an output schema means return values don't need explanation. However, for a mutation tool with safety implications, more behavioral context would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds minimal value through the example showing 'volume_id' usage, but doesn't explain what a volume ID is, where to find it, or format constraints. With only 1 parameter, this is adequate but not comprehensive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('detach') and target resource ('volume from a server'), making the purpose immediately understandable. It distinguishes from sibling 'attach_volume' by specifying the opposite operation. However, it doesn't explicitly mention the server context beyond 'from a server', which could be slightly more specific.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives or prerequisites. It doesn't mention that the volume must be currently attached, what happens to data, or any dependencies. With sibling tools like 'attach_volume' and 'delete_volume', clear usage boundaries are missing.

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

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