Skip to main content
Glama
cenemil

DNS MCP Server

by cenemil

batch_dns

Perform multiple DNS lookups simultaneously to resolve domain records efficiently in a single operation.

Instructions

Perform multiple DNS lookups in a single operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesArray of DNS queries to perform
parallelNoExecute queries in parallel
timeoutNoQuery timeout per request

Implementation Reference

  • Core implementation of batch DNS lookups. Flattens multiple queries into individual lookups executed in parallel (default) or sequentially, collecting results and errors.
    async batchLookup( queries: { domain: string; recordTypes: DnsRecordType[] }[], parallel: boolean = true ): Promise<{ results: DnsLookupResult[]; errors: DnsError[] }> { const results: DnsLookupResult[] = []; const errors: DnsError[] = []; const performQuery = async (domain: string, recordType: DnsRecordType) => { try { const result = await this.lookup(domain, recordType); results.push(result); } catch (error) { errors.push(error as DnsError); } }; const allQueries = queries.flatMap(q => q.recordTypes.map(rt => ({ domain: q.domain, recordType: rt })) ); if (parallel) { await Promise.all( allQueries.map(q => performQuery(q.domain, q.recordType)) ); } else { for (const q of allQueries) { await performQuery(q.domain, q.recordType); } } return { results, errors }; }
  • Zod schema for validating batch_dns tool inputs, defining queries array, parallel flag, and timeout.
    export const BatchDnsSchema = z.object({ queries: z.array(z.object({ domain: z.string().min(1), recordTypes: z.array(DnsRecordTypeSchema).min(1) })).min(1).max(50).describe('Array of DNS queries to perform'), parallel: z.boolean().default(true).describe('Execute queries in parallel'), timeout: z.number().min(100).max(30000).optional().describe('Query timeout per request') });
  • src/index.ts:93-131 (registration)
    Tool registration in the TOOLS array, specifying name, description, and JSON schema for MCP tool listing.
    { name: 'batch_dns', description: 'Perform multiple DNS lookups in a single operation', inputSchema: { type: 'object', properties: { queries: { type: 'array', items: { type: 'object', properties: { domain: { type: 'string' }, recordTypes: { type: 'array', items: { type: 'string', enum: ['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SOA', 'PTR', 'SRV', 'CAA'] } } }, required: ['domain', 'recordTypes'] }, description: 'Array of DNS queries to perform' }, parallel: { type: 'boolean', default: true, description: 'Execute queries in parallel' }, timeout: { type: 'number', description: 'Query timeout per request' } }, required: ['queries'] } },
  • MCP server request handler for batch_dns tool call: parses input with schema, invokes DnsResolver.batchLookup, formats and returns results with timing.
    case 'batch_dns': { const input = BatchDnsSchema.parse(args) as BatchDnsInput; const startTime = Date.now(); const { results, errors } = await dnsResolver.batchLookup( input.queries.map(q => ({ domain: q.domain, recordTypes: q.recordTypes as DnsRecordType[] })), input.parallel ); return { content: [ { type: 'text', text: JSON.stringify({ results, errors, totalTime: Date.now() - startTime, 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