Debug a Cloudflare Worker
Use this skill when an agent must find out why a Cloudflare Worker is failing,
erroring, or behaving unexpectedly.
Context
The Cloudflare MCP server uses a code-mode pattern: search (find endpoints in
the API spec) and execute (call the Cloudflare API). This skill is the
workflow that uses those tools to debug a Worker.
Workflow
1. Confirm the target
- Identify the Worker name (and account/zone context if relevant).
- Confirm read access: the server needs OAuth or a token at the client level;
say which mode you are operating in. Do not ask for tokens in conversation.
2. Check the deployment state
- Use
search to find the Worker endpoints (e.g. get_workers_script,
list_workers_versions).
execute to fetch: current script version, deployed versions, and the
latest deployment status. A failed/stuck deployment is a common cause.
3. Inspect logs and errors
- Find the Workers Logs / Tail endpoints via
search.
execute to fetch recent logs or exceptions for the Worker.
- Look for: uncaught exceptions, 5xx, binding errors (KV/D1/R2 misconfig),
or build-time failures.
4. Narrow the cause
Classify:
- Runtime error — exception in the handler; correlate with the failing
request/URL.
- Deployment issue — wrong version live, failed deploy, rollback needed.
- Binding/config — KV/D1/R2/Env binding name mismatch, missing secret.
- Build — the uploaded bundle failed to build (check deployment status).
5. Report
State: the Worker, its deployed version(s), the log/error evidence, the root
cause, and the narrowest fix (rollback, fix binding, fix the handler, redeploy).
Mutations (deploys, binding changes) require explicit user intent — this skill
is read-first.
Guardrails
- Read-first: inspect deployments, logs, and versions; do not deploy, roll
back, or edit bindings without explicit user intent.
- Do not print secrets, API tokens, or binding secret values.
1---2name: debug-worker3description: Debug a Cloudflare Worker: check deployment state, inspect logs, find errors, and narrow the cause. Use when a Worker misbehaves, returns errors, or after a failed deploy.4---56# Debug a Cloudflare Worker78Use this skill when an agent must find out why a Cloudflare Worker is failing,9erroring, or behaving unexpectedly.1011## Context1213The Cloudflare MCP server uses a code-mode pattern: `search` (find endpoints in14the API spec) and `execute` (call the Cloudflare API). This skill is the15workflow that uses those tools to debug a Worker.1617## Workflow1819### 1. Confirm the target2021- Identify the Worker name (and account/zone context if relevant).22- Confirm read access: the server needs OAuth or a token at the client level;23 say which mode you are operating in. Do not ask for tokens in conversation.2425### 2. Check the deployment state2627- Use `search` to find the Worker endpoints (e.g. `get_workers_script`,28 `list_workers_versions`).29- `execute` to fetch: current script version, deployed versions, and the30 latest deployment status. A failed/stuck deployment is a common cause.3132### 3. Inspect logs and errors3334- Find the Workers Logs / Tail endpoints via `search`.35- `execute` to fetch recent logs or exceptions for the Worker.36- Look for: uncaught exceptions, 5xx, binding errors (KV/D1/R2 misconfig),37 or build-time failures.3839### 4. Narrow the cause4041Classify:4243- **Runtime error** — exception in the handler; correlate with the failing44 request/URL.45- **Deployment issue** — wrong version live, failed deploy, rollback needed.46- **Binding/config** — KV/D1/R2/Env binding name mismatch, missing secret.47- **Build** — the uploaded bundle failed to build (check deployment status).4849### 5. Report5051State: the Worker, its deployed version(s), the log/error evidence, the root52cause, and the narrowest fix (rollback, fix binding, fix the handler, redeploy).53Mutations (deploys, binding changes) require explicit user intent — this skill54is read-first.5556## Guardrails5758- Read-first: inspect deployments, logs, and versions; do not deploy, roll59 back, or edit bindings without explicit user intent.60- Do not print secrets, API tokens, or binding secret values.61