dns_lookup_direct
Query DNS records for domains to retrieve A, AAAA, MX, TXT, NS, CNAME, or SOA records for security research and data gathering.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to lookup | |
| type | Yes | Record type |
Implementation Reference
- src/index.ts:151-156 (handler)The handler function for the "dns_lookup_direct" tool in src/index.ts.
async ({ domain, type }) => { const result = await directDnsClient.lookup(domain, type); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } - src/index.ts:145-157 (registration)Registration of the "dns_lookup_direct" tool.
server.tool( "dns_lookup_direct", { domain: z.string().describe("Domain name to lookup"), type: z.enum(["A", "AAAA", "MX", "TXT", "NS", "CNAME", "SOA"]).describe("Record type"), }, async ({ domain, type }) => { const result = await directDnsClient.lookup(domain, type); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } ); - src/tools/dns.ts:7-22 (handler)The lookup implementation inside the DirectDnsClient class, called by the tool handler.
async lookup(domain: string, type: "A" | "AAAA" | "MX" | "TXT" | "NS" | "CNAME" | "SOA" | "PTR"): Promise<any> { try { switch (type) { case "A": return await dns.resolve4(domain); case "AAAA": return await dns.resolve6(domain); case "MX": return await dns.resolveMx(domain); case "TXT": return await dns.resolveTxt(domain); case "NS": return await dns.resolveNs(domain); case "CNAME": return await dns.resolveCname(domain); case "SOA": return await dns.resolveSoa(domain); default: throw new Error(`Unsupported record type: ${type}`); } } catch (error) { throw new McpError(ErrorCode.InternalError, `DNS Lookup failed: ${(error as Error).message}`); } }