Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

get_firewall

Retrieve detailed configuration and status information for a specific Hetzner Cloud firewall using its unique ID to manage network security rules.

Instructions

Get details about a specific firewall.

Returns detailed information about a firewall identified by its ID.

Example:
- Get firewall details: {"firewall_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_firewall' tool. It takes a firewall_id parameter, fetches the firewall using the Hetzner Cloud client, and returns its details as a dictionary using the firewall_to_dict helper.
    @mcp.tool()
    def get_firewall(params: FirewallIdParam) -> Dict[str, Any]:
        """
        Get details about a specific firewall.
        
        Returns detailed information about a firewall identified by its ID.
        
        Example:
        - Get firewall details: {"firewall_id": 12345}
        """
        try:
            firewall = client.firewalls.get_by_id(params.firewall_id)
            if not firewall:
                return {"error": f"Firewall with ID {params.firewall_id} not found"}
            
            return {"firewall": firewall_to_dict(firewall)}
        except Exception as e:
            return {"error": f"Failed to get firewall: {str(e)}"}
  • Pydantic input schema for the get_firewall tool, defining the required firewall_id integer parameter.
    class FirewallIdParam(BaseModel):
        firewall_id: int = Field(..., description="The ID of the firewall")
  • Helper function that converts a Hetzner Cloud Firewall object to a dictionary format suitable for JSON serialization, used by get_firewall and other firewall tools.
    def firewall_to_dict(firewall: Firewall) -> Dict[str, Any]:
        """Convert a Firewall object to a dictionary with relevant information."""
        # Convert rules to dict
        rules = []
        if firewall.rules:
            for rule in firewall.rules:
                rule_dict = {
                    "direction": rule.direction,
                    "protocol": rule.protocol,
                    "source_ips": rule.source_ips,
                }
                if rule.port:
                    rule_dict["port"] = rule.port
                if rule.destination_ips:
                    rule_dict["destination_ips"] = rule.destination_ips
                if rule.description:
                    rule_dict["description"] = rule.description
                rules.append(rule_dict)
        
        # Convert applied_to resources to dict
        applied_to = []
        if firewall.applied_to:
            for resource in firewall.applied_to:
                resource_dict = {"type": resource.type}
                if resource.server:
                    resource_dict["server"] = {"id": resource.server.id, "name": resource.server.name}
                if resource.label_selector:
                    resource_dict["label_selector"] = {"selector": resource.label_selector.selector}
                if getattr(resource, 'applied_to_resources', None):
                    applied_resources = []
                    for applied_resource in resource.applied_to_resources:
                        applied_resource_dict = {"type": applied_resource.type}
                        if applied_resource.server:
                            applied_resource_dict["server"] = {"id": applied_resource.server.id, "name": applied_resource.server.name}
                        applied_resources.append(applied_resource_dict)
                    resource_dict["applied_to_resources"] = applied_resources
                applied_to.append(resource_dict)
        
        return {
            "id": firewall.id,
            "name": firewall.name,
            "rules": rules,
            "applied_to": applied_to,
            "labels": firewall.labels,
            "created": firewall.created.isoformat() if firewall.created else None,
        }
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 tool returns detailed information, which implies a read-only operation, but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or what 'detailed information' includes. The description is minimal and lacks critical context for safe invocation.

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 returns, and the third provides a clear example. Every sentence adds value without redundancy, and the structure is efficient for quick comprehension.

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 (single parameter) and the presence of an output schema (which handles return values), the description is somewhat complete but lacks depth. It covers the basic purpose and parameter use but misses behavioral details (e.g., error cases, permissions) and usage context, making it adequate but with clear gaps for a read operation.

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?

The input schema has 0% description coverage, with one parameter 'firewall_id' undocumented in schema. The description adds meaning by specifying that the firewall is 'identified by its ID' and provides an example with 'firewall_id': 12345, clarifying the parameter's role. However, it doesn't explain ID format, constraints, or sourcing, leaving gaps in semantic understanding.

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 firewall' and 'Returns detailed information about a firewall identified by its ID.' This specifies the verb ('Get'), resource ('firewall'), and scope ('specific firewall' by ID). It distinguishes from sibling 'list_firewalls' by focusing on a single entity rather than listing multiple, though it doesn't explicitly name the sibling.

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_firewalls' for browsing or 'get_server' for related resources, nor does it specify prerequisites (e.g., needing a firewall ID). The example shows usage but doesn't explain context or exclusions.

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