Skip to main content
Glama

dns_lookup

Resolve domain names to IP addresses using Shodan's DNS service. Supports batch resolution of multiple hostnames in a single query.

Instructions

Resolve domain names to IP addresses using Shodan's DNS service. Supports batch resolution of multiple hostnames in a single query. Returns IP addresses mapped to their corresponding hostnames.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnamesYesList of hostnames to resolve.

Implementation Reference

  • Handler for the 'dns_lookup' tool. Parses input arguments using DnsLookupArgsSchema, performs batch DNS resolution via Shodan's /dns/resolve API by joining hostnames, formats the result mapping hostnames to IPs, and returns a structured JSON response.
    case "dns_lookup": {
      const parsedDnsArgs = DnsLookupArgsSchema.safeParse(args);
      if (!parsedDnsArgs.success) {
        throw new Error("Invalid dns_lookup arguments");
      }
      
      // Join hostnames with commas for the API request
      const hostnamesString = parsedDnsArgs.data.hostnames.join(",");
      
      const result: DnsResponse = await queryShodan("/dns/resolve", {
        hostnames: hostnamesString
      });
    
      // Format the response in a user-friendly way
      const formattedResult = {
        "DNS Resolutions": Object.entries(result).map(([hostname, ip]) => ({
          "Hostname": hostname,
          "IP Address": ip
        })),
        "Summary": {
          "Total Lookups": Object.keys(result).length,
          "Queried Hostnames": parsedDnsArgs.data.hostnames
        }
      };
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(formattedResult, null, 2)
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the dns_lookup tool: an array of strings representing hostnames to resolve.
    const DnsLookupArgsSchema = z.object({
      hostnames: z.array(z.string()).describe("List of hostnames to resolve."),
    });
  • src/index.ts:331-335 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema (converted from Zod to JSON schema) for dns_lookup.
    {
      name: "dns_lookup",
      description: "Resolve domain names to IP addresses using Shodan's DNS service. Supports batch resolution of multiple hostnames in a single query. Returns IP addresses mapped to their corresponding hostnames.",
      inputSchema: zodToJsonSchema(DnsLookupArgsSchema),
    },
Behavior2/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 mentions batch resolution and the return format (IP addresses mapped to hostnames), but doesn't cover important aspects like rate limits, authentication requirements, error handling, or whether this is a read-only operation. The description provides basic behavior but lacks critical operational context.

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?

Three sentences that are front-loaded with core functionality, followed by batch capability, and ending with return format. Every sentence adds value with zero wasted words. The structure efficiently communicates the tool's purpose and capabilities.

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 single-parameter tool with no annotations and no output schema, the description provides adequate basic information about what the tool does and what it returns. However, it lacks important contextual details about authentication, rate limits, error cases, and specific usage scenarios that would help an agent use it effectively.

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 single 'hostnames' parameter. The description adds marginal value by mentioning 'batch resolution of multiple hostnames' which reinforces the array nature of the parameter, but doesn't provide additional syntax, format, or constraint 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 specific action ('Resolve domain names to IP addresses'), identifies the resource ('using Shodan's DNS service'), and distinguishes from siblings by focusing on forward DNS resolution (unlike reverse_dns_lookup or IP-based tools like ip_lookup). It provides a complete picture of what the tool does.

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

Usage Guidelines3/5

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

The description implies usage for DNS resolution tasks and mentions batch capability, but doesn't explicitly state when to use this tool versus alternatives like reverse_dns_lookup or ip_lookup. No guidance on prerequisites, limitations, or specific scenarios where this tool is preferred over others is provided.

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