Skip to main content
Glama
Cloudflare Workers MCP Server

Cloudflare Workers MCP Server

Query Worker Logs

query_worker_logs
Read-onlyIdempotent

Fetches recent log events for a Cloudflare Worker, including messages, outcomes, requests, and timing, to help debug and monitor; observability must be enabled.

Instructions

Query a Worker's logs (Workers Logs / observability). Returns the most recent matching events with message, outcome, request, and timing. The Worker must have observability enabled (deploy_worker's enable_observability or update_worker_settings).

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": "query_worker_logs"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum events to return (default 20)
cursorNoPagination cursor: pass the next_cursor from a previous call (with the same filters) to fetch the next page of older events
searchNoFull-text needle matched across all log fields
minutesNoLook-back window in minutes (default 60; retention is 3–7 days)
errors_onlyNoOnly return events that carry an error
script_nameYesThe Worker whose logs to query

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields 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"
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Pagination cursor: pass the next_cursor from a previous call (with the same filters) to fetch the next page of older events",
      +  "type": "string"
      +}
  2. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so safety is covered. The description adds value beyond that by disclosing the observability prerequisite and the shape of returned events, though it omits retention limits and pagination behavior (both only in the schema).

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

Conciseness4/5

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

Three front-loaded sentences with no filler: purpose, return shape, prerequisite in that order. Minor redundancy in the parenthetical '(Workers Logs / observability)' keeps it from a 5.

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?

With no output schema, the description usefully enumerates returned fields, and it flags the enabling prerequisite. The only real gap is no guidance on the relationship to tail_worker for live tailing versus historical queries.

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?

Schema description coverage is 100%, and every parameter is documented in-schema with defaults and bounds. The description adds no parameter-level meaning such as filter interaction or cursor/filter-matching rules, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (query a Worker's logs) and names the underlying feature area (Workers Logs / observability), plus what the response contains (message, outcome, request, timing). It does not distinguish itself from the closely related sibling tail_worker, so it falls short of a 5.

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 gives a real prerequisite — observability must be enabled via deploy_worker's enable_observability or update_worker_settings — which is actionable context. However, it never says when to use this instead of tail_worker or get_worker, so the choice among log-related siblings is left to inference.

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