Skip to main content
Glama

Roll back a Cloudflare Worker

cloudflare_workers_rollback
Destructive

Roll 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

NameRequiredDescriptionDefault
scriptYesThe Worker's name, as `list` shows it: 1–63 lowercase letters, digits, `-` and `_`.
accountNoThe label of the credential pair to use, or "default" for the unlabeled one; left out, the unlabeled pair, else the only label.
messageNoA note for the deployment: one line of 1 to 100 characters; left out, "Rolled back".
replacesYesThe 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.
versionsYesThe 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

NameRequiredDescriptionDefault
labelYesThe account label.
scriptYesThe Worker's name.
replacedYesThe deployment that served before.
deploymentYesThe 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the destructive/non-idempotent annotations it discloses the human confirmation in attended runs, the non-forcing refusal past a secrets change, that secrets are left as-is, that traffic switches immediately, and what the result contains (the replaced and the new deployment).

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?

Purpose is front-loaded and every sentence carries operational content, but the prose is dense and repeatedly re-references 'cloudflare_workers_read deployments', and the final 'Wrangler deploys new code' sentence is terse enough to read as an afterthought.

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?

For a destructive, non-idempotent mutation the description covers confirmation, failure modes, side effects on traffic and secrets, and recovery from `stale`; the return-value sentence is mildly redundant with the output schema but harmless.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description goes further by tying `replaces` to the first deployment from cloudflare_workers_read deployments and `versions` to an earlier deployment's split, and by stating the constraints that cause rejection rather than just field formats.

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?

The opening clause states a specific verb and resource ('Roll a Cloudflare Worker back to versions that served traffic before, in one new deployment') and the closing line ('Wrangler deploys new code') marks the boundary against deployment, which is the main confusion risk for a rollback tool.

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?

It names the prerequisite source of arguments (cloudflare_workers_read deployments), gives the retry rule for a `stale` refusal, states which inputs are refused, and routes the unsupported secrets-crossing case out to Wrangler `rollback` or the dashboard.

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