Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

delete_ssh_key

Permanently remove an SSH key from Hetzner Cloud by specifying its ID to manage server access and security.

Instructions

Delete an SSH key.

Permanently deletes an SSH key identified by its ID.

Example:
- Delete SSH key: {"ssh_key_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the delete_ssh_key tool. It retrieves the SSH key by ID using the Hetzner Cloud client and deletes it if found.
    @mcp.tool()
    def delete_ssh_key(params: SSHKeyIdParam) -> Dict[str, Any]:
        """
        Delete an SSH key.
        
        Permanently deletes an SSH key identified by its ID.
        
        Example:
        - Delete SSH key: {"ssh_key_id": 12345}
        """
        try:
            ssh_key = client.ssh_keys.get_by_id(params.ssh_key_id)
            if not ssh_key:
                return {"error": f"SSH key with ID {params.ssh_key_id} not found"}
                
            success = client.ssh_keys.delete(ssh_key)
            
            return {"success": success}
        except Exception as e:
            return {"error": f"Failed to delete SSH key: {str(e)}"}
  • Pydantic BaseModel defining the input schema for the delete_ssh_key tool, requiring an integer ssh_key_id.
    class SSHKeyIdParam(BaseModel):
        ssh_key_id: int = Field(..., description="The ID of the SSH key")
  • Helper function to convert SSHKey objects to dictionaries, used in related SSH key tools like list_ssh_keys and get_ssh_key.
    def ssh_key_to_dict(ssh_key: SSHKey) -> Dict[str, Any]:
        """Convert an SSHKey object to a dictionary with relevant information."""
        return {
            "id": ssh_key.id,
            "name": ssh_key.name,
            "fingerprint": ssh_key.fingerprint,
            "public_key": ssh_key.public_key,
            "labels": ssh_key.labels,
            "created": ssh_key.created.isoformat() if ssh_key.created else None,
        }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Permanently deletes', which implies irreversibility and destructive action, but doesn't cover other critical aspects like authentication requirements, error conditions (e.g., what happens if the key doesn't exist), rate limits, or confirmation prompts. The example helps but doesn't fully compensate for missing behavioral details.

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

Conciseness5/5

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

The description is perfectly concise and well-structured: a brief statement of purpose, clarification of permanence, and a helpful example. Every sentence adds value without redundancy. The front-loaded purpose statement makes it immediately scannable.

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 the tool's destructive nature and lack of annotations, the description is minimally adequate. It covers the core action and parameter, and an output schema exists (though not shown), reducing need to describe returns. However, for a permanent deletion tool, more warnings about consequences or dependencies would improve completeness. The example partially fills gaps.

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

Parameters4/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 clearly explains that the parameter 'ssh_key_id' identifies the SSH key to delete, and the example provides concrete syntax. This adds meaningful context beyond the bare schema, though it doesn't elaborate on ID format or validation rules. With only 1 parameter, this is sufficient for a high score.

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 verb ('Delete') and resource ('SSH key'), making the purpose immediately understandable. It distinguishes from siblings like 'update_ssh_key' or 'get_ssh_key' by specifying deletion. However, it doesn't explicitly contrast with all siblings (e.g., 'delete_server'), so it's not a perfect 5.

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. It doesn't mention prerequisites (e.g., needing the SSH key ID from 'list_ssh_keys'), consequences of deletion, or when to choose deletion over other operations like updating. This leaves the agent without contextual usage instructions.

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