deploy_cloudflare_worker
Deploy Cloudflare Workers with state tracking and health checks for reliable infrastructure orchestration.
Instructions
Deploy Cloudflare Worker with state tracking and health checks. DO NOT use ssh_exec('wrangler deploy') - always use this tool instead.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| worker_name | Yes | Worker name (e.g., 'voicenotes-webhook') | |
| source_dir | No | Source directory containing wrangler.toml | |
| env | No | Environment (production/staging, default: production) |
Implementation Reference
- src/index.ts:209-222 (handler)Handler logic for the 'deploy_cloudflare_worker' tool. Destructures arguments and calls the executeOrchestrator helper with operation 'deploy/cloudflare-worker' and resolved parameters.case "deploy_cloudflare_worker": { const { worker_name, source_dir, env } = args as { worker_name: string; source_dir?: string; env?: string; }; result = executeOrchestrator("deploy/cloudflare-worker", { worker_name, source_dir: source_dir || `/Users/customer/${worker_name}`, env: env || "production" }); break; }
- src/index.ts:72-89 (schema)Input schema defining the parameters for the 'deploy_cloudflare_worker' tool, including worker_name (required), source_dir, and env.inputSchema: { type: "object", properties: { worker_name: { type: "string", description: "Worker name (e.g., 'voicenotes-webhook')" }, source_dir: { type: "string", description: "Source directory containing wrangler.toml" }, env: { type: "string", description: "Environment (production/staging, default: production)" } }, required: ["worker_name"] }
- src/index.ts:69-90 (registration)Registration of the 'deploy_cloudflare_worker' tool in the tools array, including name, description, and input schema.{ name: "deploy_cloudflare_worker", description: "Deploy Cloudflare Worker with state tracking and health checks. DO NOT use ssh_exec('wrangler deploy') - always use this tool instead.", inputSchema: { type: "object", properties: { worker_name: { type: "string", description: "Worker name (e.g., 'voicenotes-webhook')" }, source_dir: { type: "string", description: "Source directory containing wrangler.toml" }, env: { type: "string", description: "Environment (production/staging, default: production)" } }, required: ["worker_name"] } },
- src/index.ts:16-43 (helper)Shared helper function executeOrchestrator that runs python orchestrator.py with the specified operation and parameters, used by all tools including deploy_cloudflare_worker.function executeOrchestrator(operation: string, params: Record<string, string> = {}): any { const paramStr = Object.entries(params) .map(([key, value]) => `${key}="${value}"`) .join(" "); const cmd = `cd ${ORCHESTRATOR_PATH} && python orchestrator.py ${operation} ${paramStr}`; try { const output = execSync(cmd, { encoding: "utf-8", maxBuffer: 10 * 1024 * 1024 }); // Try to parse as JSON, fallback to plain text try { return JSON.parse(output); } catch { return { output: output.trim() }; } } catch (error: any) { return { success: false, error: error.message, stderr: error.stderr?.toString() || "", stdout: error.stdout?.toString() || "" }; } }