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
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to lookup (e.g., 'google.com') | |
| history | No | Include historical DNS data (default: false) | |
| type | No | DNS record type filter (A, AAAA, CNAME, NS, SOA, MX, TXT) | |
| page | No | Page 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"] } },
- src/index.ts:1750-1791 (handler)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}` ); } }
- src/index.ts:532-557 (handler)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; } }