Skip to main content
Glama
ry-ops

Cloudflare MCP Server

by ry-ops

update_dns_record

Update an existing DNS record by modifying its type, name, content, TTL, proxy status, and other attributes.

Instructions

Update an existing DNS record. Can modify type, name, content, TTL, proxy status, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
zone_idYesThe zone ID
record_idYesThe DNS record ID to update
typeYesDNS record type
nameYesDNS record name
contentYesDNS record content
ttlNoTime to live
proxiedNoWhether the record is proxied through Cloudflare
priorityNoPriority (for MX, SRV records)
commentNoComment for the DNS record

Implementation Reference

  • Handler function that updates a DNS record via Cloudflare API. Constructs a PUT request to /zones/{zone_id}/dns_records/{record_id} with the required fields (type, name, content) and optional fields (ttl, proxied, priority, comment).
    async def _update_dns_record(self, args: dict) -> Any:
        """Update DNS record."""
        data = {
            "type": args["type"],
            "name": args["name"],
            "content": args["content"],
        }
    
        if "ttl" in args:
            data["ttl"] = args["ttl"]
        if "proxied" in args:
            data["proxied"] = args["proxied"]
        if "priority" in args:
            data["priority"] = args["priority"]
        if "comment" in args:
            data["comment"] = args["comment"]
    
        return await self._make_request(
            f"/zones/{args['zone_id']}/dns_records/{args['record_id']}",
            method="PUT",
            data=data,
        )
  • Schema/input definition for the update_dns_record tool. Defines required fields (zone_id, record_id, type, name, content) and optional fields (ttl, proxied, priority, comment).
    Tool(
        name="update_dns_record",
        description="Update an existing DNS record. Can modify type, name, content, TTL, proxy status, etc.",
        inputSchema={
            "type": "object",
            "properties": {
                "zone_id": {"type": "string", "description": "The zone ID"},
                "record_id": {
                    "type": "string",
                    "description": "The DNS record ID to update",
                },
                "type": {"type": "string", "description": "DNS record type"},
                "name": {"type": "string", "description": "DNS record name"},
                "content": {"type": "string", "description": "DNS record content"},
                "ttl": {"type": "number", "description": "Time to live"},
                "proxied": {
                    "type": "boolean",
                    "description": "Whether the record is proxied through Cloudflare",
                },
                "priority": {
                    "type": "number",
                    "description": "Priority (for MX, SRV records)",
                },
                "comment": {
                    "type": "string",
                    "description": "Comment for the DNS record",
                },
            },
            "required": ["zone_id", "record_id", "type", "name", "content"],
        },
    ),
  • Registration in call_tool handler that routes the 'update_dns_record' tool name to the _update_dns_record method.
    elif name == "update_dns_record":
        result = await self._update_dns_record(arguments)
  • Helper function _make_request used by _update_dns_record to perform the actual HTTP PUT request to the Cloudflare API.
    async def _make_request(
        self,
        endpoint: str,
        method: str = "GET",
        data: Optional[dict] = None,
        params: Optional[dict] = None,
    ) -> Any:
        """Make a request to the Cloudflare API."""
        url = f"{CLOUDFLARE_API_BASE}{endpoint}"
        headers = {
            "Authorization": f"Bearer {self.api_token}",
            "Content-Type": "application/json",
        }
    
        try:
            response = await self.client.request(
                method=method,
                url=url,
                json=data,
                params=params,
                headers=headers,
            )
            response.raise_for_status()
            result = response.json()
    
            if not result.get("success"):
                errors = result.get("errors", [])
                raise Exception(f"Cloudflare API error: {json.dumps(errors)}")
    
            return result.get("result")
    
        except httpx.HTTPError as e:
            raise Exception(f"HTTP error occurred: {str(e)}")
Behavior2/5

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

No annotations provided, so description must fully disclose behavior. It states 'update' but does not mention error handling, idempotency, return value, or authorization requirements.

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

Conciseness4/5

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

Single sentence, 14 words, efficient and clear. Could front-load more critical info but remains concise.

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?

No output schema, no description of return value or error conditions. For a tool with 9 parameters (5 required), more contextual guidance is needed.

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?

Schema coverage is 100% with descriptions for all parameters. Description adds minimal value (just lists some fields) but does not significantly extend beyond schema.

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

Purpose5/5

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

Description clearly states the tool updates an existing DNS record and lists modifiable fields (type, name, content, TTL, proxy status). It distinguishes from sibling tools like create_dns_record and delete_dns_record.

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?

No guidance on when to use update versus create or delete. No mention of prerequisites (record must exist) or context for usage.

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/ry-ops/cloudflare-mcp-server'

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