Skip to main content
Glama
seayniclabs

Keel

by seayniclabs

reverse_dns

Resolve an IP address to its associated domain name using reverse DNS lookup.

Instructions

Perform a reverse DNS lookup for an IP address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes

Implementation Reference

  • The async handler function for the 'reverse_dns' tool. It validates the IP address, performs a reverse DNS lookup using dnspython (dns.reversename.from_address + dns.resolver.resolve PTR), and returns a dict with 'ip', 'hostnames', and optionally 'error'.
    @mcp.tool()
    async def reverse_dns(ip: str) -> dict:
        """Perform a reverse DNS lookup for an IP address."""
        ip = validate_host(ip)
        try:
            ipaddress.ip_address(ip)
        except ValueError:
            raise ValueError(f"reverse_dns requires an IP address, got: {ip!r}")
    
        try:
            rev_name = dns.reversename.from_address(ip)
            answers = await asyncio.get_event_loop().run_in_executor(
                None, lambda: dns.resolver.resolve(rev_name, "PTR")
            )
            hostnames = [str(r) for r in answers]
        except Exception as exc:
            return {"ip": ip, "hostnames": [], "error": str(exc)}
    
        return {"ip": ip, "hostnames": hostnames}
  • The @mcp.tool() decorator that registers reverse_dns as an MCP tool on the FastMCP server instance.
    # ---------------------------------------------------------------------------
    # 5. reverse_dns
    # ---------------------------------------------------------------------------
  • Test for the reverse_dns tool that verifies the expected dict shape (ip and hostnames/error keys present).
    @pytest.mark.asyncio
    async def test_reverse_dns_shape():
        """reverse_dns should return the expected dict shape."""
        result = await reverse_dns("8.8.8.8")
        assert "ip" in result
        assert "hostnames" in result or "error" in result
  • Import of reverse_dns from sounding.server in the test file.
    reverse_dns,
Behavior2/5

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

With no annotations, the description fails to disclose any behavioral traits such as whether multiple PTR records are returned, query time, or network dependency.

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 single-sentence description is concise and front-loaded, with no unnecessary words.

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

Completeness1/5

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

Despite high purpose clarity, the description is incomplete: no information on return format, error cases, or behavior for non-resolvable IPs. With 0% schema coverage and no output schema, more context is needed.

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

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description does not explain the format or constraints of the 'ip' parameter (IPv4/IPv6, CIDR notation) beyond the schema's type and required flag.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs a reverse DNS lookup for an IP address, distinguishing it from siblings like dns_lookup and whois_lookup.

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?

No guidance on when to use this tool vs alternatives (e.g., dns_lookup for forward lookups). No context on prerequisites or best use cases.

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/seayniclabs/sounding'

If you have feedback or need assistance with the MCP directory API, please join our Discord server