Skip to main content
Glama
cenemil

DNS MCP Server

by cenemil

dns_trace

Trace DNS resolution paths from root servers to final results to diagnose DNS issues and understand domain delegation chains.

Instructions

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

Input Schema

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

Implementation Reference

  • The core handler function traceDns in DnsResolver class that performs DNS tracing from root servers through delegation chain to final resolution.
    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; } }
  • Zod schema defining input for dns_trace tool: domain (required) and optional recordType.
    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') });
  • src/index.ts:132-151 (registration)
    Tool registration in TOOLS array, defining name, description, and inputSchema for dns_trace.
    { 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'] } }
  • Dispatcher handler case in CallToolRequestSchema that parses input, calls dnsResolver.traceDns, and 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) } ] }; }
Install Server

Other 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