Add a custom domain to a Cloudflare Pages project
cloudflare_pages_domain_addAttaches 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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The custom domain's hostname, as in www.example.com: lowercased, with an internationalized name turned into punycode and a trailing dot dropped. No wildcard. | |
| account | No | The label of the credential pair to use, or "default" for the unlabeled one; left out, the unlabeled pair, else the only label. | |
| project | Yes | The Pages project's name, as `list` shows it: 1–58 lowercase letters, digits and `-`, starting with a letter or digit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dns | Yes | The 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. | |
| cname | Yes | The DNS record the domain waits for; adding the domain creates none. | |
| label | Yes | The account label. | |
| domain | Yes | The domain as Cloudflare reports it right after adding it: pending, not yet serving. | |
| errors | No | The steps that failed after the write was done, keyed by step, as `code: message`; absent when none did. | |
| project | Yes | The Pages project's name. |