Roll back a Cloudflare Worker
cloudflare_workers_rollbackRoll a Cloudflare Worker back to an earlier deployment's versions and traffic shares, replacing the current deployment after confirmation.
Instructions
Roll a Cloudflare Worker back to versions that served traffic before, in one new deployment; the tool always asks first in attended runs. The arguments come from cloudflare_workers_read deployments: replaces is the id of the first deployment (the one serving now), versions the versions and shares of an earlier deployment to return to. A version that never served is refused, and so is the split that serves now; stale means another deployment came first, so read the deployments again before trying again. Cloudflare refuses a rollback past a change of the Worker's secrets; this tool never forces it, and the user decides in Wrangler (wrangler rollback) or the dashboard. Visitors get the old code at once, and the Worker's secrets stay as they are now. The result holds the deployment it replaced and the new one. Wrangler deploys new code.
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": {
"script": "<script>",
"versions": "<versions>",
"replaces": "<replaces>"
},
"name": "cloudflare_workers_rollback"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | The Worker's name, as `list` shows it: 1–63 lowercase letters, digits, `-` and `_`. | |
| 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. | |
| message | No | A note for the deployment: one line of 1 to 100 characters; left out, "Rolled back". | |
| replaces | Yes | The id (a UUID) of the deployment serving now: the first of cloudflare_workers_read deployments. The call is refused as stale when another deployment came first. | |
| versions | Yes | The 2 versions at most to serve and their shares of traffic, from an earlier deployment of cloudflare_workers_read deployments (or one version at 100); the percentages add up to 100. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | The account label. | |
| script | Yes | The Worker's name. | |
| replaced | Yes | The deployment that served before. | |
| deployment | Yes | The new deployment: its id and what Cloudflare reports, with the versions, shares and message the call sent where Cloudflare's reply leaves them out; null when the reply names no deployment. |