Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

list_ssh_keys

Retrieve all SSH keys stored in your Hetzner Cloud account to manage server access and authentication.

Instructions

List all SSH keys in your Hetzner Cloud account.

Returns a list of all SSH key instances with their details.

Example:
- Basic list: list_ssh_keys()

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the list_ssh_keys tool. It fetches all SSH keys from the Hetzner client and formats them using the ssh_key_to_dict helper.
    def list_ssh_keys() -> Dict[str, Any]:
        """
        List all SSH keys in your Hetzner Cloud account.
        
        Returns a list of all SSH key instances with their details.
        
        Example:
        - Basic list: list_ssh_keys()
        """
        try:
            ssh_keys = client.ssh_keys.get_all()
            return {
                "ssh_keys": [ssh_key_to_dict(ssh_key) for ssh_key in ssh_keys]
            }
        except Exception as e:
            return {"error": f"Failed to list SSH keys: {str(e)}"}
  • Helper function used by list_ssh_keys to convert Hetzner SSHKey objects into serializable dictionaries for the tool response.
    # Helper function to convert SSHKey object to dict
    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 list_ssh_keys function as an MCP tool.
    def list_ssh_keys() -> Dict[str, Any]:
Behavior3/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 the action ('List all SSH keys') and return value ('list of all SSH key instances with their details'), which covers the core behavior. However, it lacks details on pagination, rate limits, authentication needs, or error handling, which are important for a cloud API tool. The example adds minimal practical context.

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 front-loaded with the core purpose, followed by return details and a simple example. It's efficient with three sentences, though the example is very basic and could be more informative (e.g., mentioning output format). There's no wasted text, but it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, 100% schema coverage, and an output schema (implied by 'Returns a list'), the description is reasonably complete. It covers what the tool does and what it returns, which is sufficient for a simple list operation. However, it misses behavioral nuances like pagination or error cases, which could be relevant in a cloud 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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description correctly doesn't discuss parameters, focusing instead on the tool's purpose and output. This aligns well with the schema, earning a high score for not adding unnecessary information.

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 ('List') and resource ('all SSH keys in your Hetzner Cloud account'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_ssh_key' (which presumably retrieves a single key), leaving room for minor confusion about when to choose one over the other.

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 'get_ssh_key' or other list tools (e.g., 'list_servers'). It mentions a basic example but lacks explicit context, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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