dns_lookup
Query DNS records (A, AAAA, NS, MX, TXT, CNAME, SOA) for any domain using specified DNS servers to verify configurations and troubleshoot connectivity.
Instructions
Look up all common DNS records (A, AAAA, NS, MX, TXT, CNAME, SOA) for a domain. Returns results from a specified DNS server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name to look up (e.g. example.com) | |
| server | No | DNS server to query. Default: cloudflare. Use 'authoritative' for the domain's own nameservers. |
Implementation Reference
- src/tools.ts:96-115 (handler)The handler logic for dns_lookup, which calls the /v1/records API.
async ({ domain, server: dnsServer }) => { try { const params: Record<string, string> = { domain }; if (dnsServer) params.server = dnsServer; const result = await apiGet("/v1/records", params); return { content: [{ type: "text", text: formatJson(result) }] }; } catch (error) { return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } ); - src/tools.ts:84-95 (registration)Registration of the dns_lookup tool with its schema definition using Zod.
server.tool( "dns_lookup", "Look up all common DNS records (A, AAAA, NS, MX, TXT, CNAME, SOA) for a domain. Returns results from a specified DNS server.", { domain: z.string().describe("Domain name to look up (e.g. example.com)"), server: z .enum(DNS_SERVERS) .optional() .describe( "DNS server to query. Default: cloudflare. Use 'authoritative' for the domain's own nameservers." ), },