Skip to main content
Glama

Clear caches

wp_clear_cache
Destructive

Flush WordPress object cache, OPcache, and supported page caches to make recent changes visible when stale cached pages or data still appear. Purges cached copies only; pages rebuild on next request.

Instructions

Flush the WordPress object cache, OPcache if available, and the whole page cache of the supported caching plugins present (LiteSpeed Cache, WP Super Cache, W3 Total Cache, WP Fastest Cache, SiteGround Speed Optimizer, Breeze, Nginx Helper, WP Rocket, Cache Enabler, WP-Optimize, Hummingbird). Suited to making a change visible that a cache still serves in its old form; expired transients are removed by wp_cleanup_transients. page_cache_purged lists the ones asked to purge; a cache none of them drives (host, CDN) is not reached. On a multisite network a plugin that can only empty every site at once runs only for a user who holds the network right that plugin asks for; page_cache_skipped names it and why. Returns object_cache_flushed, opcache_reset and page_cache_purged, plus page_cache_failed and page_cache_skipped where a purge failed or was left out. Only cached copies go: pages and queries are built afresh on their next request, so the site can answer slower for a short while. Requires manage_options; no undo point is recorded.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations: declares the manage_options requirement, that no undo point is recorded, the multisite network-capability nuance with page_cache_skipped reporting, and the transient performance cost ('site can answer slower for a short while'). This is exactly the mutation-safety context annotations alone (destructiveHint=true) cannot convey.

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 the action and the scope, then conditions, then return shape — a sensible order. The eleven-plugin enumeration is long but earns its place by bounding which caches are actually purged; minor trimming of that list would tighten it slightly.

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?

A no-parameter, high-impact mutation tool with no output schema is fully covered: what is flushed, what is skipped and why, the permission gate, the irreversibility, the return keys, and the performance side effect are all stated.

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?

Zero parameters, so there is nothing to disambiguate and the baseline of 4 applies. The description compensates by documenting the output keys (object_cache_flushed, opcache_reset, page_cache_purged, page_cache_failed, page_cache_skipped) that the missing output schema would otherwise leave opaque.

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 (flush) and enumerates the exact resources affected: object cache, OPcache, and page caches of named plugins. It also explicitly distinguishes itself from the sibling wp_cleanup_transients, so an agent can choose between the two without opening a 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?

Gives the triggering condition ('making a change visible that a cache still serves in its old form') and names the alternative for transient cleanup (wp_cleanup_transients). It further bounds usage by noting that host/CDN caches are not reached, which tells the agent when this tool will not achieve the goal.

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

Deploy Server

Other Tools