Skip to main content
Glama
badchars

osint-mcp-server

by badchars

dns_lookup

Resolve DNS records for a domain, supporting A, AAAA, MX, TXT, NS, SOA, CNAME, and SRV types.

Instructions

Resolve DNS records for a domain. Supports A, AAAA, MX, TXT, NS, SOA, CNAME, SRV record types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name to query
typeYesDNS record type

Implementation Reference

  • The core implementation of dns_lookup. Uses Node.js built-in node:dns/promises to resolve DNS records. Supports A, AAAA, MX, TXT, NS, SOA, CNAME, and SRV record types. Returns an array of DnsRecord objects.
    export async function dnsLookup(domain: string, type: string): Promise<DnsRecord[]> {
      const records: DnsRecord[] = [];
    
      switch (type.toUpperCase()) {
        case "A": {
          const ips = await dns.resolve4(domain);
          for (const ip of ips) records.push({ type: "A", value: ip });
          break;
        }
        case "AAAA": {
          const ips = await dns.resolve6(domain);
          for (const ip of ips) records.push({ type: "AAAA", value: ip });
          break;
        }
        case "MX": {
          const mxs = await dns.resolveMx(domain);
          for (const mx of mxs) records.push({ type: "MX", value: mx.exchange, priority: mx.priority });
          break;
        }
        case "TXT": {
          const txts = await dns.resolveTxt(domain);
          for (const txt of txts) records.push({ type: "TXT", value: txt.join("") });
          break;
        }
        case "NS": {
          const nss = await dns.resolveNs(domain);
          for (const ns of nss) records.push({ type: "NS", value: ns });
          break;
        }
        case "SOA": {
          const soa = await dns.resolveSoa(domain);
          records.push({
            type: "SOA",
            value: `${soa.nsname} ${soa.hostmaster} ${soa.serial} ${soa.refresh} ${soa.retry} ${soa.expire} ${soa.minttl}`,
          });
          break;
        }
        case "CNAME": {
          const cname = await dns.resolveCname(domain);
          for (const c of cname) records.push({ type: "CNAME", value: c });
          break;
        }
        case "SRV": {
          const srvs = await dns.resolveSrv(domain);
          for (const s of srvs) {
            records.push({ type: "SRV", value: s.name, priority: s.priority, weight: s.weight, port: s.port });
          }
          break;
        }
        default:
          throw new Error(`Unsupported DNS record type: ${type}`);
      }
    
      return records;
    }
  • Tool definition and schema for dns_lookup. Defines the tool name 'dns_lookup', description, Zod schema for 'domain' (string) and 'type' (enum of A/AAAA/MX/TXT/NS/SOA/CNAME/SRV), and the execute handler that calls dnsLookup().
    const dnsLookupTool: ToolDef = {
      name: "dns_lookup",
      description: "Resolve DNS records for a domain. Supports A, AAAA, MX, TXT, NS, SOA, CNAME, SRV record types.",
      schema: {
        domain: z.string().describe("Domain name to query"),
        type: z.enum(["A", "AAAA", "MX", "TXT", "NS", "SOA", "CNAME", "SRV"]).describe("DNS record type"),
      },
      execute: async (args) => json(await dnsLookup(args.domain as string, args.type as string)),
    };
  • Registration of dns_lookup in the exported allTools array. The dnsLookupTool is included as the first entry in the DNS tools group (line 483).
    export const allTools: ToolDef[] = [
      // DNS (6)
      dnsLookupTool,
      dnsReverseTool,
      dnsEmailSecurityTool,
      dnsSpfChainTool,
      dnsSrvDiscoverTool,
      dnsWildcardCheckTool,
  • Import of the dnsLookup function from src/dns/index.js into the tools registry module.
    import { dnsLookup, dnsReverse, dnsEmailSecurity, dnsSpfChain, dnsSrvDiscover, dnsWildcardCheck } from "../dns/index.js";
  • src/index.ts:24-26 (registration)
    CLI category listing that includes 'dns_lookup' in the DNS tool group (no API key required). Also referenced in example usage on line 53.
    label: "DNS",
    env: null,
    tools: ["dns_lookup", "dns_reverse", "dns_email_security", "dns_spf_chain", "dns_srv_discover", "dns_wildcard_check"],

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are present, so the description carries full burden. It does not disclose behaviors such as recursion, timeouts, or limitations (e.g., only public domains). The description is minimal and does not add behavioral context beyond the basic function.

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 sentence plus a list, with no wasted words. It is front-loaded with the main action and efficiently conveys supported types.

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?

The description provides the basics but lacks context about return values (no output schema) and when to use this tool versus siblings. It is adequate for a simple lookup but could benefit from specifying what the response contains.

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% (both parameters have descriptions). The description adds a list of supported record types, which corresponds to the 'type' enum. However, it does not add significant extra meaning beyond the schema, so a baseline of 3 is appropriate.

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 verb 'resolve' and resource 'DNS records for a domain', and lists the supported record types (A, AAAA, MX, TXT, NS, SOA, CNAME, SRV). This distinguishes it from sibling tools like bgp_asn or geoip_lookup, which deal with different data.

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?

No guidance is provided on when to use this tool versus alternatives like dns_reverse or dns_email_security. There is no explicit context for when to use or not use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.