Skip to main content
Glama

reverse_dns_lookup

Find hostnames associated with IP addresses using reverse DNS lookups. Supports batch queries for multiple IPs and returns all known hostnames or indicates when none are found.

Instructions

Perform reverse DNS lookups to find hostnames associated with IP addresses. Supports batch lookups of multiple IP addresses in a single query. Returns all known hostnames for each IP address, with clear indication when no hostnames are found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipsYesList of IP addresses to perform reverse DNS lookup on.

Implementation Reference

  • The handler function for the 'reverse_dns_lookup' tool within the switch statement in CallToolRequestSchema handler. It validates input using the schema, calls the Shodan reverse DNS API, formats the response mapping IPs to hostnames, and returns a structured text content.
    case "reverse_dns_lookup": {
      const parsedArgs = ReverseDnsLookupArgsSchema.safeParse(args);
      if (!parsedArgs.success) {
        throw new Error("Invalid reverse_dns_lookup arguments");
      }
      
      // Join IPs with commas for the API request
      const ipsString = parsedArgs.data.ips.join(",");
      
      const result: ReverseDnsResponse = await queryShodan("/dns/reverse", {
        ips: ipsString
      });
    
      // Format the response in a user-friendly way
      const formattedResult = {
        "Reverse DNS Resolutions": Object.entries(result).map(([ip, hostnames]) => ({
          "IP Address": ip,
          "Hostnames": hostnames.length > 0 ? hostnames : ["No hostnames found"]
        })),
        "Summary": {
          "Total IPs Queried": parsedArgs.data.ips.length,
          "IPs with Results": Object.keys(result).length,
          "Queried IP Addresses": parsedArgs.data.ips
        }
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(formattedResult, null, 2)
          },
        ],
      };
    }
  • Zod schema defining the input for reverse_dns_lookup: an array of IP address strings.
    const ReverseDnsLookupArgsSchema = z.object({
      ips: z.array(z.string()).describe("List of IP addresses to perform reverse DNS lookup on."),
    });
  • src/index.ts:346-350 (registration)
    Tool registration in the ListToolsRequestSchema handler, providing name, description, and JSON schema derived from Zod schema.
    {
      name: "reverse_dns_lookup",
      description: "Perform reverse DNS lookups to find hostnames associated with IP addresses. Supports batch lookups of multiple IP addresses in a single query. Returns all known hostnames for each IP address, with clear indication when no hostnames are found.",
      inputSchema: zodToJsonSchema(ReverseDnsLookupArgsSchema),
    },
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 describes the batch capability, return format (all known hostnames), and handling of missing results. However, it doesn't mention rate limits, authentication needs, or error conditions that would be important for a network tool.

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 with three sentences that each add value: states the core purpose, describes batch capability, and explains return behavior. No wasted words and front-loaded with the main functionality.

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?

For a network lookup tool with no annotations and no output schema, the description provides adequate basic information but lacks details about response format structure, error handling, and operational constraints that would be important for complete understanding.

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?

Schema description coverage is 100%, so the schema already documents the 'ips' parameter. The description adds context about batch lookups and what the parameter represents, but doesn't provide additional syntax or format details beyond what the schema provides.

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's purpose with specific verbs ('perform reverse DNS lookups', 'find hostnames') and resources ('IP addresses'). It distinguishes from sibling tools like 'dns_lookup' and 'ip_lookup' by specifying the reverse direction and batch capability.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to find hostnames from IP addresses with batch support). It doesn't explicitly mention when not to use it or name alternatives, but the context is sufficient for basic differentiation from siblings.

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/BurtTheCoder/mcp-shodan'

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