Skip to main content
Glama
Cyreslab-AI

Shodan MCP Server

dns_lookup

Resolve hostnames to IP addresses for cybersecurity research and threat intelligence using DNS lookup.

Instructions

Resolve hostnames to IP addresses using DNS lookup

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnamesYesList of hostnames to resolve (e.g., ['google.com', 'facebook.com'])

Implementation Reference

  • MCP tool handler for 'dns_lookup' in the CallToolRequestSchema switch statement. Validates input, calls ShodanClient.dnsLookup, and formats response.
    case "dns_lookup": {
      const hostnames = request.params.arguments?.hostnames;
      if (!Array.isArray(hostnames) || hostnames.length === 0) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Hostnames array is required"
        );
      }
    
      try {
        const dnsResults = await shodanClient.dnsLookup(hostnames.map(String));
        return {
          content: [{
            type: "text",
            text: JSON.stringify(dnsResults, null, 2)
          }]
        };
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Error performing DNS lookup: ${(error as Error).message}`
        );
      }
  • ShodanClient method that performs the actual DNS lookup API call to Shodan /dns/resolve endpoint.
    async dnsLookup(hostnames: string[]): Promise<any> {
      try {
        const response = await this.axiosInstance.get("/dns/resolve", {
          params: { hostnames: hostnames.join(',') }
        });
        return response.data;
      } catch (error: unknown) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Shodan API error: ${error.response?.data?.error || error.message}`
          );
        }
        throw error;
      }
    }
  • Input schema definition for the 'dns_lookup' tool in the ListToolsRequestSchema response.
    name: "dns_lookup",
    description: "Resolve hostnames to IP addresses using DNS lookup",
    inputSchema: {
      type: "object",
      properties: {
        hostnames: {
          type: "array",
          items: {
            type: "string"
          },
          description: "List of hostnames to resolve (e.g., ['google.com', 'facebook.com'])"
        }
      },
      required: ["hostnames"]
    }
  • src/index.ts:1087-1103 (registration)
    Registration of the 'dns_lookup' tool in the tools list returned by ListToolsRequestSchema handler.
    {
      name: "dns_lookup",
      description: "Resolve hostnames to IP addresses using DNS lookup",
      inputSchema: {
        type: "object",
        properties: {
          hostnames: {
            type: "array",
            items: {
              type: "string"
            },
            description: "List of hostnames to resolve (e.g., ['google.com', 'facebook.com'])"
          }
        },
        required: ["hostnames"]
      }
    },
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. While it mentions the basic operation (DNS resolution), it fails to describe important behavioral aspects such as whether it performs recursive or iterative lookups, timeout behavior, error handling for unresolvable hostnames, rate limits, or authentication requirements. This leaves significant gaps for an agent to understand how the tool behaves in practice.

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 a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a straightforward tool and gets directly to the point with no unnecessary elaboration.

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 relatively simple lookup tool with good schema coverage but no annotations or output schema, the description provides the basic purpose but lacks important contextual information about behavior, limitations, and output format. It's minimally adequate but leaves the agent guessing about practical implementation details.

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 schema description coverage is 100%, with the single parameter 'hostnames' well-documented in the schema itself. The description doesn't add any additional parameter semantics beyond what's already in the schema, so it meets the baseline expectation when the schema does the heavy lifting.

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 hostnames to IP addresses') and the mechanism ('using DNS lookup'), which distinguishes it from sibling tools like 'reverse_dns_lookup' that perform the opposite operation. It uses precise technical terminology that leaves no ambiguity about its function.

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 like 'reverse_dns_lookup' or 'get_domain_info', nor does it mention any prerequisites, constraints, or typical use cases. It simply states what the tool does without contextual usage information.

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/Cyreslab-AI/shodan-mcp-server'

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