Skip to main content
Glama
gilberth

MCP Cloudflare DNS Server

get_dns_record

Retrieve a specific DNS record by its unique ID using this tool, designed for managing Cloudflare DNS records through the MCP Cloudflare DNS Server.

Instructions

Get a specific DNS record by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordIdYesThe DNS record ID

Implementation Reference

  • The MCP tool handler for 'get_dns_record'. Configures API, fetches record via CloudflareApi.getDnsRecord, formats and returns text response.
    const handleGetDnsRecord = async (args: { recordId: string }) => { try { if (!configureApiIfNeeded()) { return { content: [{ type: "text", text: "❌ Configuration incomplete. Please configure Cloudflare API Token and Zone ID first." }], }; } const record = await CloudflareApi.getDnsRecord(args.recordId); return { content: [{ type: "text", text: `✅ DNS Record Details: 🔹 Name: ${record.name} 🔹 Type: ${record.type} 🔹 Content: ${record.content} 🔹 TTL: ${record.ttl} 🔹 Proxied: ${record.proxied ? 'Yes' : 'No'} ${record.priority ? `🔹 Priority: ${record.priority}` : ''} 🔹 ID: ${record.id} 🔹 Created: ${new Date(record.created_on).toLocaleString()} 🔹 Modified: ${new Date(record.modified_on).toLocaleString()}` }], }; } catch (error) { return { content: [{ type: "text", text: `❌ Error getting DNS record: ${error instanceof Error ? error.message : 'Unknown error'}` }], }; } };
  • Core Cloudflare API helper that makes the HTTP GET request to retrieve a specific DNS record by its ID.
    getDnsRecord: async (recordId: string): Promise<DnsRecord> => { const response = await api(`dns_records/${recordId}`); const data = CloudflareApiResponse.parse(await response.json()); if (!data.success) { throw new Error(`API Error: ${data.errors.map(e => e.message).join(', ')}`); } if (!data.result || Array.isArray(data.result)) { throw new Error('DNS record not found'); } return data.result; },
  • src/index.ts:67-80 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for 'get_dns_record'.
    { name: "get_dns_record", description: "Get a specific DNS record by ID", inputSchema: { type: "object", properties: { recordId: { type: "string", description: "The DNS record ID", }, }, required: ["recordId"], }, },
  • Input schema definition for the 'get_dns_record' tool as part of its registration.
    { name: "get_dns_record", description: "Get a specific DNS record by ID", inputSchema: { type: "object", properties: { recordId: { type: "string", description: "The DNS record ID", }, }, required: ["recordId"], }, },

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/gilberth/mcp-cloudflare'

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