Skip to main content
Glama

Delete expired transients

wp_cleanup_transients
Destructive

Delete expired WordPress transients by removing option rows whose timeout has passed, leaving unexpired and site transients untouched, and return the count deleted.

Instructions

Delete the expired transients: every transient whose transient_timeout row in the options table has passed is deleted through WordPress (value and timeout). Transients not yet expired and site transients (site_transient) are left alone. Returns deleted, the number of expired transients found and handed to WordPress for deletion. With a persistent object cache WordPress deletes in the cache only, so the old option rows can remain. Requires manage_options.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well past the annotations: it discloses that deletion goes through WordPress, that a persistent object cache means only the cache entries are removed and option rows may linger, and that manage_options is required. It also explains the 'deleted' return value's meaning, which annotations 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.

Conciseness5/5

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

The scope constraint is front-loaded in the first sentence, followed by the negative scope, return value, cache caveat and permission requirement in descending order of importance. Every sentence carries distinct information with no restatement of the title.

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?

With no output schema, the description must describe the return value — it does. For a destructive, non-idempotent operation with zero parameters, it supplies scope, safety caveat, permission gate and return semantics, leaving nothing an agent needs before calling it.

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?

The tool takes zero parameters, so the baseline is 4; the description correctly implies there is nothing to configure. It does add meaning about the response shape ('deleted, the number of expired transients found') that the empty schema cannot express.

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 ('Delete the expired transients') and then defines the exact criterion: every transient whose _transient_timeout_ row in the options table has passed. It also scopes negatively by naming what is not touched (unexpired and _site_transient_), which no sibling tool claims.

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 scope of the operation is clear, so an agent can infer this is a maintenance/cleanup tool, but it never states when to reach for it over neighbours like wp_clear_cache or wp_db_optimize. No explicit 'use this when' or exclusion guidance is given.

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