Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

get_ssh_key

Retrieve details for a specific SSH key by its ID to manage access to Hetzner Cloud resources.

Instructions

Get details about a specific SSH key.

Returns detailed information about an SSH key identified by its ID.

Example:
- Get SSH key details: {"ssh_key_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_ssh_key' tool. It retrieves an SSH key by ID from the Hetzner Cloud API using the client, converts it to a dictionary using ssh_key_to_dict, and returns it or an error.
    @mcp.tool()
    def get_ssh_key(params: SSHKeyIdParam) -> Dict[str, Any]:
        """
        Get details about a specific SSH key.
        
        Returns detailed information about an SSH key identified by its ID.
        
        Example:
        - Get SSH key details: {"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"}
            
            return {"ssh_key": ssh_key_to_dict(ssh_key)}
        except Exception as e:
            return {"error": f"Failed to get SSH key: {str(e)}"}
  • Pydantic model defining the input schema for the get_ssh_key tool, requiring the SSH key ID.
    class SSHKeyIdParam(BaseModel):
        ssh_key_id: int = Field(..., description="The ID of the SSH key")
  • Helper function that converts a Hetzner Cloud SSHKey object to a serializable dictionary format, used in get_ssh_key and list_ssh_keys tools.
    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,
        }
  • The @mcp.tool() decorator registers the get_ssh_key function as an MCP tool with the name 'get_ssh_key'.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get details'), which implies it's non-destructive, but doesn't cover other aspects like authentication requirements, rate limits, error conditions, or what 'detailed information' includes beyond the ID. The example helps but is minimal.

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 appropriately sized and front-loaded: the first sentence states the purpose, the second elaborates on the return, and the third provides a concise example. Every sentence adds value without redundancy, making it efficient and well-structured.

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 low complexity (one parameter) and the presence of an output schema (which handles return values), the description is mostly adequate. However, it lacks context on usage versus siblings and behavioral details like error handling, which are important for a read operation in a server management context.

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?

The description adds meaning beyond the input schema, which has 0% description coverage. It explains that the parameter 'ssh_key_id' is used to identify a specific SSH key, and the example illustrates its usage. Since there's only one parameter, the description adequately compensates for the schema's lack of documentation.

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 tool's purpose: 'Get details about a specific SSH key' and 'Returns detailed information about an SSH key identified by its ID.' This specifies the verb ('Get') and resource ('SSH key'), though it doesn't explicitly differentiate from sibling tools like 'list_ssh_keys' or 'update_ssh_key' beyond the 'specific' qualifier.

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 sibling tools like 'list_ssh_keys' (for listing all keys) or 'update_ssh_key' (for modifying keys), nor does it specify prerequisites such as needing an existing SSH key ID.

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