Skip to main content
Glama
gilberth

MCP Cloudflare DNS Server

delete_dns_record

Remove a specified DNS record from Cloudflare by providing its ID using this tool on the MCP Cloudflare DNS Server.

Instructions

Delete a DNS record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordIdYesThe DNS record ID to delete

Implementation Reference

  • The primary handler function for the 'delete_dns_record' tool in the MCP server. It checks configuration, calls the Cloudflare API via CloudflareApi.deleteDnsRecord, handles errors, and returns a formatted response.
    const handleDeleteDnsRecord = async (args: { recordId: string }) => {
      try {
        if (!configureApiIfNeeded()) {
          return {
            content: [{ type: "text", text: "❌ Configuration incomplete. Please configure Cloudflare API Token and Zone ID first." }],
          };
        }
        
        await CloudflareApi.deleteDnsRecord(args.recordId);
        
        return {
          content: [{ 
            type: "text", 
            text: `✅ DNS record deleted successfully! (ID: ${args.recordId})`
          }],
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `❌ Error deleting DNS record: ${error instanceof Error ? error.message : 'Unknown error'}` }],
        };
      }
    };
  • Core helper function that performs the actual HTTP DELETE request to Cloudflare's API to delete the DNS record by ID, including response validation.
    deleteDnsRecord: async (recordId: string): Promise<void> => {
      const response = await api(`dns_records/${recordId}`, 'DELETE');
      const data = CloudflareApiResponse.parse(await response.json());
      
      if (!data.success) {
        throw new Error(`API Error: ${data.errors.map(e => e.message).join(', ')}`);
      }
    },
  • src/index.ts:157-170 (registration)
    Registration of the 'delete_dns_record' tool in the MCP server's listTools response, including name, description, and input schema.
    {
      name: "delete_dns_record",
      description: "Delete a DNS record",
      inputSchema: {
        type: "object",
        properties: {
          recordId: {
            type: "string",
            description: "The DNS record ID to delete",
          },
        },
        required: ["recordId"],
      },
    },
  • src/index.ts:195-197 (registration)
    Dispatch logic in the MCP CallToolRequestHandler that routes calls to 'delete_dns_record' to the appropriate handler function.
    if (name === "delete_dns_record") {
      return await handleDeleteDnsRecord(args as { recordId: string });
    }
  • Response validation using CloudflareApiResponse schema after the DELETE API call.
      const data = CloudflareApiResponse.parse(await response.json());
      
      if (!data.success) {
        throw new Error(`API Error: ${data.errors.map(e => e.message).join(', ')}`);
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Delete' which implies a destructive mutation, but fails to add critical context such as whether deletion is permanent, requires specific permissions, has rate limits, or what happens on success/failure. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—'Delete a DNS record' is front-loaded and directly conveys the core action. Every word earns its place, making it highly concise and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature, lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral risks, usage context, or expected outcomes, leaving gaps that could hinder an agent's ability to invoke it correctly. More detail is needed for a mutation tool in this environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with recordId clearly documented as 'The DNS record ID to delete'. The description adds no additional meaning beyond this, as it doesn't elaborate on parameter format, sourcing (e.g., from list_dns_records), or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and resource ('a DNS record'), making the purpose immediately understandable. It distinguishes itself from siblings like create_dns_record, get_dns_record, list_dns_records, and update_dns_record by specifying deletion. However, it lacks specificity about what type of DNS record (e.g., A, CNAME, MX) or scope, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a recordId from list_dns_records), exclusions (e.g., not for bulk deletion), or comparisons with siblings like update_dns_record for modifications. This leaves the agent without context for proper tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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