dns_record
Query specific DNS record types for domains to retrieve A, MX, TXT, CNAME, and other DNS data using customizable server options.
Instructions
Look up a specific DNS record type for a domain. Supports 53 record types including A, AAAA, MX, TXT, CNAME, SOA, PTR, CAA, SRV, DNSKEY, DS, TLSA, HTTPS, SPF, and more.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name (or IP address for PTR lookups) to query (e.g. example.com) | |
| type | Yes | DNS record type (e.g. A, MX, TXT, CNAME, SPF, HTTPS, DNSKEY) | |
| server | No | DNS server to query. Default: cloudflare. Use 'authoritative' for the domain's own nameservers. |
Implementation Reference
- src/tools.ts:117-154 (handler)The handler implementation for the 'dns_record' tool. It validates the input using Zod and calls the `/v1/records/other` API endpoint.
// Tool 2: DNS Record — get a specific record type server.tool( "dns_record", "Look up a specific DNS record type for a domain. Supports 53 record types including A, AAAA, MX, TXT, CNAME, SOA, PTR, CAA, SRV, DNSKEY, DS, TLSA, HTTPS, SPF, and more.", { domain: z .string() .describe( "Domain name (or IP address for PTR lookups) to query (e.g. example.com)" ), type: z.enum(DNS_RECORD_TYPES).describe("DNS record type (e.g. A, MX, TXT, CNAME, SPF, HTTPS, DNSKEY)"), server: z .enum(DNS_SERVERS) .optional() .describe( "DNS server to query. Default: cloudflare. Use 'authoritative' for the domain's own nameservers." ), }, async ({ domain, type, server: dnsServer }) => { try { const params: Record<string, string> = { domain, type }; if (dnsServer) params.server = dnsServer; const result = await apiGet("/v1/records/other", 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, }; } } );