Deploy Worker
deploy_workerDeploy or update a Cloudflare Worker by uploading ES module scripts with optional bindings; existing secrets remain unless overridden.
Instructions
Upload and deploy a Worker script (ES modules) with optional bindings (plain_text, secret_text, kv_namespace, r2_bucket, d1, assets). Replaces the Worker's code and binding set if it already exists; existing secrets are kept unless you pass a binding with the same name. Each module is either inline content or a local file path; prefer path for bundled or large code (the server reads the file, so the source stays out of the conversation, and binary .wasm modules work). Set keep_assets to retain a site's static assets while updating code. By default a new Worker is served on workers.dev.
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_name": "<script_name>",
"modules": "<modules>"
},
"name": "deploy_worker"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modules | Yes | Modules, each with inline content or a local file path; the first is the entry point unless main_module says otherwise | |
| bindings | No | Resource bindings (replaces the full set) | |
| keep_assets | No | Retain the previous version's static assets (deploy code changes to a site without re-uploading files) | |
| main_module | No | Entry-point module name (default: first module) | |
| script_name | Yes | Worker name (lowercase, alphanumeric and hyphens) | |
| compatibility_date | No | YYYY-MM-DD; defaults to today (if omitted at the API level it would fall back to 2021-11-02) | |
| enable_workers_dev | No | Serve the Worker at <script_name>.<account>.workers.dev. Default: enabled for newly created Workers; existing Workers keep their current setting. | |
| compatibility_flags | No | Runtime compatibility flags. nodejs_compat is on by default for compatibility_date >= 2026-08-04, so it is not needed with the default (today) date | |
| enable_observability | No | Enable Workers Logs for this Worker (required for query_worker_logs) |