Skip to main content
Glama

Add a custom domain to a Cloudflare Pages project

cloudflare_pages_domain_add
Destructive

Attaches a custom hostname to a Cloudflare Pages project and returns its pending status plus the required CNAME target. Create that proxied DNS record with a DNS tool to activate the domain.

Instructions

Add a custom domain, a hostname, to a Cloudflare Pages project; the tool always asks first in attended runs, since visitors to the hostname get the project's site once it is live. The hostname must be in a zone Cloudflare lets the account use; one it reserves or the account cannot use is refused. Adding creates no DNS record: the domain stays pending until a proxied CNAME record from the hostname to the project's pages.dev address exists (cname in the result), and then goes active in a few minutes; read cloudflare_pages_read domains for its status. DNS changes stay with the cloudflare_dns_* tools. dns holds the records already at that name in the account's zone: when no CNAME to cname.content is among them, create it with cloudflare_dns_record_add; when another record holds the name, the domain stays pending until the person decides what to do with it. The result holds the domain with its status and the validation it waits for; a step after the add that fails is listed under errors and the domain stays added. Removing a domain is cloudflare_pages_domain_remove.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "project": "<project>",
      "name": "<name>"
    },
    "name": "cloudflare_pages_domain_add"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesThe custom domain's hostname, as in www.example.com: lowercased, with an internationalized name turned into punycode and a trailing dot dropped. No wildcard.
accountNoThe label of the credential pair to use, or "default" for the unlabeled one; left out, the unlabeled pair, else the only label.
projectYesThe Pages project's name, as `list` shows it: 1–58 lowercase letters, digits and `-`, starting with a letter or digit.

Output Schema

NameRequiredDescriptionDefault
dnsYesThe records already at that name in the account's zone, or null when the account has no such zone. When no CNAME to `cname.content` is among them, create it with cloudflare_dns_record_add; when another record holds the name, the domain stays pending until the person decides what to do with it.
cnameYesThe DNS record the domain waits for; adding the domain creates none.
labelYesThe account label.
domainYesThe domain as Cloudflare reports it right after adding it: pending, not yet serving.
errorsNoThe steps that failed after the write was done, keyed by step, as `code: message`; absent when none did.
projectYesThe Pages project's name.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and openWorldHint=true, but the description adds substantial context the annotations cannot convey: no DNS record is created, the domain sits pending until a proxied CNAME to the pages.dev address exists, activation takes a few minutes, partial failures surface under `errors` while the domain stays added. What it does not quantify is blast radius on the live site beyond 'visitors get the project's site once it is live'.

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?

Front-loaded with the action and its confirmation behavior, then the pending/CNAME mechanics and next-step routing. Every sentence carries operational weight, though the single dense paragraph runs long and could be split into short blocks for faster scanning.

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

Completeness5/5

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

Covers preconditions, the confirmation gate, the post-add pending state, which sibling tools to use for DNS and status, and failure semantics. With an output schema present it need not document return values, and nothing an agent needs to call this correctly is missing.

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% and the schema already documents hostname normalization, the credential label, and the project-name constraints, so baseline 3 applies. The description mentions output fields (`cname`, `dns`, `errors`) rather than adding parameter-level semantics beyond what the schema supplies.

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?

States a precise verb and resource ('Add a custom domain, a hostname, to a Cloudflare Pages project') and explicitly separates itself from adding DNS records ('Adding creates no DNS record') and from removal ('Removing a domain is cloudflare_pages_domain_remove'). An agent can tell it apart from cloudflare_dns_record_add without opening either schema.

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

Usage Guidelines5/5

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

Gives explicit routing: use cloudflare_pages_read domains to check status, use cloudflare_dns_record_add to create the required CNAME, use cloudflare_pages_domain_remove to undo. It also states a precondition (the tool asks first in attended runs) and a refusal condition (hostname in a zone the account cannot use).

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