Skip to main content
Glama

reverse_dns_lookup

Find hostnames associated with IP addresses using reverse DNS lookup. Supports batch processing of multiple IPs in a single query and returns all known hostnames for each address.

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 switch case handler for the 'reverse_dns_lookup' tool. Parses input arguments, calls Shodan /dns/reverse API with comma-joined IPs, formats results mapping IPs to hostnames (or 'No hostnames found'), and returns formatted JSON as 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)
    Registration of the reverse_dns_lookup tool in the ListToolsRequestSchema handler, including name, description, and converted input 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), },
  • TypeScript interface for the Shodan reverse DNS API response structure, mapping IP strings to arrays of hostnames.
    interface ReverseDnsResponse { [ip: string]: string[]; // Maps IP address to array of hostnames }

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