Skip to main content
Glama
Cloudflare Workers MCP Server

Cloudflare Workers MCP Server

Get Worker Code

get_worker_code
Read-onlyIdempotent

Download a Worker's live source code as one entry per module; service-worker scripts return a single script, while assets-only Workers return no code.

Instructions

Download the source code of a Worker's live version: one entry per module. Service-worker-syntax Workers return a single script; assets-only Workers have no 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_name": "<script_name>"
    },
    "name": "get_worker_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
script_nameYesThe name of the Worker script

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.4.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. First observedv1.0.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive behavior. The description adds useful output-shape behavior: one entry per module, single script for service-worker syntax, and no code for assets-only Workers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, front-loaded with the action and followed by the key return-shape caveat. There is no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter read tool, the description covers purpose and major output variations. It does not detail response structure beyond module entries, but no output schema exists, so a minor gap remains.

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

Parameters3/5

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

The only parameter, script_name, is fully documented in the schema as 'The name of the Worker script.' The description does not add syntax or format details beyond that, so schema coverage carries the parameter semantics.

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?

Uses a specific verb and resource: 'Download the source code of a Worker's live version.' It also clarifies the live-version scope and module-entry output, which distinguishes it from general Worker metadata tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use it by saying it downloads live Worker code, but it does not explicitly compare against siblings such as get_worker, get_version, or list_versions. No when-not guidance is provided.

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