Skip to main content
Glama
Cyreslab-AI

Shodan MCP Server

get_domain_info

Retrieve comprehensive domain data including subdomains, DNS records, and historical information for cybersecurity analysis and threat intelligence.

Instructions

Get comprehensive domain information including subdomains and DNS records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name to lookup (e.g., 'google.com')
historyNoInclude historical DNS data (default: false)
typeNoDNS record type filter (A, AAAA, CNAME, NS, SOA, MX, TXT)
pageNoPage number for pagination (default: 1)

Implementation Reference

  • src/index.ts:1122-1146 (registration)
    Registration of the 'get_domain_info' tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.
      name: "get_domain_info",
      description: "Get comprehensive domain information including subdomains and DNS records",
      inputSchema: {
        type: "object",
        properties: {
          domain: {
            type: "string",
            description: "Domain name to lookup (e.g., 'google.com')"
          },
          history: {
            type: "boolean",
            description: "Include historical DNS data (default: false)"
          },
          type: {
            type: "string",
            description: "DNS record type filter (A, AAAA, CNAME, NS, SOA, MX, TXT)"
          },
          page: {
            type: "number",
            description: "Page number for pagination (default: 1)"
          }
        },
        required: ["domain"]
      }
    },
  • Primary MCP CallToolRequestSchema handler for 'get_domain_info' tool. Validates parameters, calls ShodanClient.getDomainInfo, handles errors, and formats response as JSON text.
    case "get_domain_info": {
      const domain = String(request.params.arguments?.domain);
      if (!domain) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Domain name is required"
        );
      }
    
      const history = Boolean(request.params.arguments?.history);
      const type = request.params.arguments?.type ? String(request.params.arguments.type) : undefined;
      const page = Number(request.params.arguments?.page) || 1;
    
      try {
        const domainInfo = await shodanClient.getDomainInfo(domain, history, type, page);
    
        // Check if we got an error response from the domain info method
        if (domainInfo.error && domainInfo.status === 401) {
          return {
            content: [{
              type: "text",
              text: JSON.stringify(domainInfo, null, 2)
            }]
          };
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(domainInfo, null, 2)
          }]
        };
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Error getting domain info: ${(error as Error).message}`
        );
      }
    }
  • Core implementation in ShodanClient.getDomainInfo: makes API request to Shodan /dns/domain/{domain} endpoint with parameters, handles 401 errors specifically, returns data or throws McpError.
    async getDomainInfo(domain: string, history: boolean = false, type?: string, page: number = 1): Promise<any> {
      try {
        const params: any = { history, page };
        if (type) {
          params.type = type;
        }
    
        const response = await this.axiosInstance.get(`/dns/domain/${domain}`, { params });
        return response.data;
      } catch (error: unknown) {
        if (axios.isAxiosError(error)) {
          if (error.response?.status === 401) {
            return {
              error: "Unauthorized: The DNS domain lookup requires a paid membership. Your API key does not have access to this endpoint.",
              message: "The domain information functionality requires a Shodan membership subscription with API access. Please upgrade your Shodan plan to use this feature.",
              status: 401
            };
          }
          throw new McpError(
            ErrorCode.InternalError,
            `Shodan API error: ${error.response?.data?.error || error.message}`
          );
        }
        throw error;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Get' implies a read-only operation, the description lacks details on permissions, rate limits, data freshness, pagination behavior (implied by the 'page' parameter), or what 'comprehensive' entails beyond subdomains and DNS records. This leaves significant gaps for a tool with 4 parameters.

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 front-loads the core purpose without unnecessary words. Every part of the sentence contributes to understanding the tool's scope, making it appropriately sized for its function.

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

Completeness2/5

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

Given the complexity of a 4-parameter tool with no annotations and no output schema, the description is insufficient. It doesn't explain the return format, error conditions, or how 'comprehensive' information is structured, leaving the agent with incomplete context for proper invocation and result interpretation.

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 input schema fully documents all parameters. The description adds minimal value beyond the schema by mentioning 'subdomains and DNS records', which loosely relates to the 'type' parameter but doesn't provide additional syntax, format, or usage context. This meets the baseline for high schema coverage.

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

Purpose4/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 as 'Get comprehensive domain information including subdomains and DNS records', which specifies the verb ('Get'), resource ('domain information'), and scope ('subdomains and DNS records'). However, it doesn't explicitly differentiate from sibling tools like 'dns_lookup' or 'reverse_dns_lookup', which likely have overlapping functionality.

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. With multiple sibling tools related to DNS and domain queries (e.g., 'dns_lookup', 'reverse_dns_lookup'), there's no indication of when this comprehensive tool is preferred over more specific ones, nor any mention of prerequisites or exclusions.

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