Skip to main content
Glama

DNS MCP Server

by cenemil

dns_trace

Trace the complete DNS resolution path from root servers to the final result for a specified domain and record type using the DNS MCP Server.

Instructions

Trace the DNS resolution path from root servers to the final result

Input Schema

NameRequiredDescriptionDefault
domainYesThe domain to trace DNS resolution path
recordTypeNoThe record type to traceA

Input Schema (JSON Schema)

{ "properties": { "domain": { "description": "The domain to trace DNS resolution path", "type": "string" }, "recordType": { "default": "A", "description": "The record type to trace", "enum": [ "A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA" ], "type": "string" } }, "required": [ "domain" ], "type": "object" }

Implementation Reference

  • Core handler function that performs DNS tracing: resolves root NS, iteratively NS for domain parts from TLD up, final lookup.
    async traceDns(domain: string, recordType: DnsRecordType = 'A'): Promise<any> { const trace: any[] = []; try { const rootServers = await this.resolver.resolveNs('.'); trace.push({ level: 'root', servers: rootServers }); const parts = domain.split('.').reverse(); let currentDomain = ''; for (const part of parts) { currentDomain = currentDomain ? `${part}.${currentDomain}` : part; try { const nsRecords = await this.resolver.resolveNs(currentDomain); trace.push({ level: currentDomain, servers: nsRecords }); } catch (error) { break; } } const finalResult = await this.lookup(domain, recordType); trace.push({ level: 'final', result: finalResult }); return trace; } catch (error: any) { throw { code: 'TRACE_FAILED', message: error.message || 'DNS trace failed', domain, recordType } as DnsError; } }
  • MCP tool call handler: parses input with schema and delegates to DnsResolver.traceDns, formats response.
    case 'dns_trace': { const input = DnsTraceSchema.parse(args) as DnsTraceInput; const trace = await dnsResolver.traceDns( input.domain, input.recordType as DnsRecordType ); return { content: [ { type: 'text', text: JSON.stringify({ domain: input.domain, recordType: input.recordType, trace, timestamp: new Date().toISOString() }, null, 2) } ] }; }
  • src/index.ts:132-151 (registration)
    Tool registration in TOOLS array with name, description, and inputSchema for MCP ListTools.
    { name: 'dns_trace', description: 'Trace the DNS resolution path from root servers to the final result', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'The domain to trace DNS resolution path' }, recordType: { type: 'string', enum: ['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SOA', 'PTR', 'SRV', 'CAA'], default: 'A', description: 'The record type to trace' } }, required: ['domain'] } }
  • Zod schema for input validation (domain, optional recordType) and TypeScript type inference.
    export const DnsTraceSchema = z.object({ domain: z.string().min(1).describe('The domain to trace DNS resolution path'), recordType: DnsRecordTypeSchema.default('A').describe('The record type to trace') }); export type DnsLookupInput = z.infer<typeof DnsLookupSchema>; export type ReverseDnsInput = z.infer<typeof ReverseDnsSchema>; export type BatchDnsInput = z.infer<typeof BatchDnsSchema>; export type DnsTraceInput = z.infer<typeof DnsTraceSchema>;

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cenemil/dns-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server