Skip to main content
Glama

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
NameRequiredDescriptionDefault
worker_nameYesWorker name (e.g., 'voicenotes-webhook')
source_dirNoSource directory containing wrangler.toml
envNoEnvironment (production/staging, default: production)

Implementation Reference

  • 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;
    }
  • 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"]
      }
    },
  • 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() || ""
        };
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/itsablabla/lastrock-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server