Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

resize_volume

Increase the size of a Hetzner Cloud volume to expand storage capacity. Specify volume ID and new size in GB.

Instructions

Resize a volume.

Increases the size of a volume (size can only be increased, not decreased).

Example:
- Resize volume: {"volume_id": 12345, "size": 100}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The resize_volume MCP tool handler. Retrieves the volume by ID, validates that the new size is larger than current, calls the Hetzner Cloud API client.volumes.resize(), and returns success with action details or error.
    @mcp.tool()
    def resize_volume(params: ResizeVolumeParams) -> Dict[str, Any]:
        """
        Resize a volume.
        
        Increases the size of a volume (size can only be increased, not decreased).
        
        Example:
        - Resize volume: {"volume_id": 12345, "size": 100}
        """
        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 params.size <= volume.size:
                return {"error": f"New size ({params.size} GB) must be greater than current size ({volume.size} GB)"}
            
            action = client.volumes.resize(volume, params.size)
            
            # 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 resize volume: {str(e)}"}
  • Pydantic schema/model for resize_volume tool parameters: volume_id (required int) and size (required int, new size in GB). Used for input validation.
    class ResizeVolumeParams(BaseModel):
        volume_id: int = Field(..., description="The ID of the volume")
        size: int = Field(..., description="New size of the volume in GB (must be greater than current size)")
  • The @mcp.tool() decorator registers the resize_volume function as an MCP tool.
    @mcp.tool()
  • Helper function to convert Hetzner Volume object to dictionary format, used in volume listing and details tools (potentially relevant for resize_volume responses).
    def volume_to_dict(volume: Volume) -> Dict[str, Any]:
        """Convert a Volume object to a dictionary with relevant information."""
        return {
            "id": volume.id,
            "name": volume.name,
            "size": volume.size,
            "location": volume.location.name if volume.location else None,
            "server": volume.server.id if volume.server else None,
            "linux_device": volume.linux_device,
            "protection": {
                "delete": volume.protection["delete"] if volume.protection else False,
            },
            "labels": volume.labels,
            "format": volume.format,
            "created": volume.created.isoformat() if volume.created else None,
            "status": volume.status,
        }
Behavior2/5

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

With no annotations provided, the description carries full burden. It discloses the irreversible 'increase-only' behavior and provides an example, but lacks critical details: whether this requires specific permissions, if it causes downtime, what happens to data, rate limits, or what the output contains. For a mutation tool with zero annotation coverage, this is insufficient.

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 brief with three sentences: purpose statement, behavioral constraint, and example. Each sentence adds value, though the example could be more informative. It's front-loaded with the core action.

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 a mutation tool with no annotations but an output schema (which handles return values), the description covers the basic operation and constraint. However, it misses important context like permissions, side effects, or error cases that would be crucial for safe agent invocation.

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 description must compensate. It mentions 'volume_id' and 'size' in the example and clarifies that size must be greater than current size, adding meaning beyond the bare schema. However, it doesn't explain parameter formats, constraints beyond the increase requirement, or error handling for invalid inputs.

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 ('resize a volume') and specifies the direction ('size can only be increased, not decreased'), which distinguishes it from generic volume modification tools. However, it doesn't explicitly differentiate from sibling tools like 'update_firewall' or 'create_volume' beyond the obvious resource focus.

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 like 'create_volume' for new volumes or other volume-related tools. It mentions the size increase constraint but doesn't address prerequisites, error conditions, or integration with sibling operations.

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