Skip to main content
Glama

dns-query

Query DNS records for a specific domain and record type, such as A, AAAA, MX, TXT, CNAME, or NS, using a standardized MCP interface for accurate results.

Instructions

Make a DNS query for a given name and type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe domain name to query
typeYesThe DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)

Implementation Reference

  • The handler function for the dns-query tool. It resolves the DNS records for the given domain name and type using Node.js dns/promises module, formats the result as JSON, and returns it as text content.
    async ({ name, type }) => { if (!name || !type) { // TODO: Validate inputs } const resolver = new dns.Resolver(); const records = await resolver.resolve(name, type); return { content: [ { type: "text", text: JSON.stringify({ domain: name, type: type, records: records, }), }, ], }; }
  • Zod schema defining the input parameters: 'name' (domain string) and 'type' (DNS record type string).
    { name: z.string().describe("The domain name to query"), type: z .string() .describe("The DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)"), },
  • src/server.ts:16-46 (registration)
    Registration of the 'dns-query' tool on the MCP server using server.tool(), including description, input schema, and handler function.
    server.tool( "dns-query", "Make a DNS query for a given name and type", { name: z.string().describe("The domain name to query"), type: z .string() .describe("The DNS record type (A, AAAA, MX, TXT, CNAME, NS, etc.)"), }, async ({ name, type }) => { if (!name || !type) { // TODO: Validate inputs } const resolver = new dns.Resolver(); const records = await resolver.resolve(name, type); return { content: [ { type: "text", text: JSON.stringify({ domain: name, type: type, records: records, }), }, ], }; } );

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/glucn/mcp-dns'

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