Skip to main content
Glama

Purge Cached Content

purge_cache
Destructive

Delete cached content across Cloudflare data centers and tiers to force fresh origin fetches. Choose specific URLs, tags, hosts, prefixes, or the entire zone.

Instructions

Deletes cached content in every Cloudflare data center and cache tier, including Cache Reserve. The next request for purged content is a cache MISS: Cloudflare fetches the full response from your origin and caches it again. Cloudflare does not serve purged content from cache again, even if your origin is unavailable.

To keep content cached and have Cloudflare revalidate it with your origin instead, use POST /zones/{zone_id}/invalidate_cache.

Choose what to purge

Send one of these fields in the request body:

  • files: specific URLs. If your cache key includes request headers, send each URL with the header values it was cached with.

  • tags: all content whose Cache-Tag response header contains one of the tags.

  • hosts: all content cached for the hostnames.

  • prefixes: all content whose URL starts with one of the prefixes.

  • purge_everything: all cached content in the zone.

Check the result

A 200 response with success: true means Cloudflare accepted the request. It does not confirm that any content was cached or removed. To check, request a purged URL and confirm that the CF-Cache-Status response header is MISS.

Availability and limits

Rate limits and the number of items you can send in one request depend on your plan. See Purge cache: availability and limits. Every change requires explicit confirmation; never repeat an unknown outcome automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNoExact private profile label. Account/zone defaults route inputs; token permissions remain provider controlled.
confirmNoSet true only when the user asked for exactly this action.
payloadNoComplete current native JSON request body. Do not mix with payload_file.
zone_idNoThe zone ID.
payload_fileNoRegular non-symlink local JSON request file, at most 1 MiB. No credentials in public files.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed28 schema fields changedv3.0.1
    • changedInput schema / properties / confirm / description
      Previous value: -"Must be true for the exact selected mutation, target and reviewed request."New value: +"Set true only when the user asked for exactly this action."
    • addedInput schema / properties / payload / $defs / cache-purge_Everything / $ref
      Added value: +"#/$defs/cache-purge_Everything"
    • removedInput schema / properties / payload / $defs / cache-purge_Everything / properties
      Removed value: -{
      -  "purge_everything": {
      -    "description": "Set to `true` to target all cached content in the zone, or in the environment for the environment endpoints. Must be the only field in the request. See [Purge everything](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/).",
      -    "type": "boolean"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_Everything / title
      Removed value: -"Purge everything"
    • removedInput schema / properties / payload / $defs / cache-purge_Everything / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByHostnames / $ref
      Added value: +"#/$defs/cache-purge_FlexPurgeByHostnames"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByHostnames / properties
      Removed value: -{
      -  "hosts": {
      -    "description": "Hostnames, such as `www.example.com`. Targets all content cached for these hostnames. See [Purge cache by hostname](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/).",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByHostnames / title
      Removed value: -"Purge by hostnames"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByHostnames / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByPrefixes / $ref
      Added value: +"#/$defs/cache-purge_FlexPurgeByPrefixes"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByPrefixes / properties
      Removed value: -{
      -  "prefixes": {
      -    "description": "URL prefixes, each a hostname followed by a path, such as `www.example.com/blog/`. Targets all content whose URL starts with one of these prefixes. Do not include a scheme, query string, or fragment. See [Purge cache by prefix](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/).",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByPrefixes / title
      Removed value: -"Purge by prefixes"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByPrefixes / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByTags / $ref
      Added value: +"#/$defs/cache-purge_FlexPurgeByTags"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByTags / properties
      Removed value: -{
      -  "tags": {
      -    "description": "Cache tags. Targets all content whose `Cache-Tag` response header contains at least one of these tags. See [Purge cache by cache-tags](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/).",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByTags / title
      Removed value: -"Purge by tags"
    • removedInput schema / properties / payload / $defs / cache-purge_FlexPurgeByTags / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_SingleFile / $ref
      Added value: +"#/$defs/cache-purge_SingleFile"
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFile / properties
      Removed value: -{
      -  "files": {
      -    "description": "Full URLs, such as `https://www.example.com/css/styles.css`. Targets the content cached for each URL. If your cache key includes request headers, send objects with `url` and `headers` instead. See [Purge by single-file](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/).",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFile / title
      Removed value: -"Purge files"
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFile / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_SingleFileWithUrlAndHeaders / $ref
      Added value: +"#/$defs/cache-purge_SingleFileWithUrlAndHeaders"
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFileWithUrlAndHeaders / properties
      Removed value: -{
      -  "files": {
      -    "description": "URLs with the request headers your cache key uses. Use this form when your cache key includes request headers, or the visitor's device type, country, or language: send the header values each URL was cached with, such as `CF-Device-Type`, `CF-IPCountry`, or `Accept-Language`.\n\nWhen you send the `Origin` header, include the scheme and hostname. Include the port unless it is the default for the scheme: 80 for `http`, 443 for `https`.\n\nSee [Purge by single-file](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/).\n",
      -    "items": {
      -      "properties": {
      -        "headers": {
      -          "additionalProperties": {
      -            "type": "string"
      -          },
      -          "description": "Request headers and the values the content was cached with.",
      -          "type": "object"
      -        },
      -        "url": {
      -          "description": "Full URL of the content.",
      -          "type": "string"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFileWithUrlAndHeaders / title
      Removed value: -"Purge files with URL and headers"
    • removedInput schema / properties / payload / $defs / cache-purge_SingleFileWithUrlAndHeaders / type
      Removed value: -"object"
    • addedInput schema / properties / payload / $defs / cache-purge_identifier / $ref
      Added value: +"#/$defs/cache-purge_identifier"
    • removedInput schema / properties / payload / $defs / cache-purge_identifier / maxLength
      Removed value: -32
    • removedInput schema / properties / payload / $defs / cache-purge_identifier / type
      Removed value: -"string"
  2. First observedv2.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive and non-idempotent, but the description goes further: it explains the concrete consequence (origin refetch, purged content never served from cache even if origin is down), the confirmation requirement ('Every change requires explicit confirmation; never repeat an unknown outcome automatically'), and plan-dependent rate limits. That is rich behavioral context beyond the structured fields.

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?

Front-loaded with purpose and organized under clear headers (Choose what to purge, Check the result, Availability and limits). It is longer than typical but nearly every sentence carries operational value; a minor trim of the repeated verification caveat would tighten it.

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

Completeness5/5

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

For a destructive, zone-scoped operation with no output schema, the description covers scope, semantics, the caveat that `success: true` does not confirm removal, how to verify via `CF-Cache-Status`, and limits. Nothing an agent needs to invoke it safely is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds synthesis value by grouping the anyOf body variants by intent and stating the exclusivity rule ('Send one of these fields'), helping the agent pick the right purge mode, though the individual field semantics mostly mirror the schema.

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?

States a specific verb and resource with scope: 'Deletes cached content in every Cloudflare data center and cache tier, including Cache Reserve.' It also explains the post-purge behavior (next request is a MISS) and names the sibling endpoint for the alternative behavior, so an agent can distinguish this from a revalidation tool without opening the schema.

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

Usage Guidelines5/5

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

Explicitly routes between this tool and `POST /zones/{zone_id}/invalidate_cache` based on intent (revalidate vs. evict). It also enumerates the mutually exclusive purge modes and tells the agent how to verify the outcome.

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