Skip to main content
Glama

DNS MCP Server

by cenemil

reverse_dns

Resolve IP addresses to hostnames using reverse DNS lookup. Identify domain names associated with specific IPs for network diagnostics or verification. Ensure accurate results with configurable query timeouts.

Instructions

Perform reverse DNS lookup to find the hostname for an IP address

Input Schema

NameRequiredDescriptionDefault
ipAddressYesThe IP address to perform reverse lookup on
timeoutNoQuery timeout in milliseconds

Input Schema (JSON Schema)

{ "properties": { "ipAddress": { "description": "The IP address to perform reverse lookup on", "type": "string" }, "timeout": { "description": "Query timeout in milliseconds", "type": "number" } }, "required": [ "ipAddress" ], "type": "object" }

Implementation Reference

  • MCP tool handler for reverse_dns: parses input schema, performs reverse lookup via DnsResolver, formats and returns result as JSON text content
    case 'reverse_dns': { const input = ReverseDnsSchema.parse(args) as ReverseDnsInput; logger.info(`Reverse DNS lookup for ${input.ipAddress}`); const hostnames = await dnsResolver.reverseLookup(input.ipAddress); logger.debug('Reverse DNS result', hostnames); return { content: [ { type: 'text', text: JSON.stringify({ ipAddress: input.ipAddress, hostnames, timestamp: new Date().toISOString() }, null, 2) } ] }; }
  • Core implementation of reverse DNS lookup using Node.js dns.resolver.reverse() method with error handling
    async reverseLookup(ipAddress: string): Promise<string[]> { try { return await this.resolver.reverse(ipAddress); } catch (error: any) { throw { code: error.code || 'REVERSE_LOOKUP_FAILED', message: error.message || 'Reverse lookup failed', domain: ipAddress } as DnsError; } }
  • Zod schema for validating ReverseDnsInput (ipAddress required as IP string, optional timeout)
    export const ReverseDnsSchema = z.object({ ipAddress: z.string().ip().describe('The IP address to perform reverse lookup on'), timeout: z.number().min(100).max(30000).optional().describe('Query timeout in milliseconds') });
  • src/index.ts:75-92 (registration)
    Registers the reverse_dns tool in the TOOLS array for MCP server, providing name, description, and JSON input schema
    { name: 'reverse_dns', description: 'Perform reverse DNS lookup to find the hostname for an IP address', inputSchema: { type: 'object', properties: { ipAddress: { type: 'string', description: 'The IP address to perform reverse lookup on' }, timeout: { type: 'number', description: 'Query timeout in milliseconds' } }, required: ['ipAddress'] } },

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