Skip to main content
Glama

Optimize database tables

wp_db_optimize
Destructive

Runs OPTIMIZE TABLE on every WordPress table matching the site's prefix to reclaim unused space and defragment them, returning optimized count and table names.

Instructions

Run OPTIMIZE TABLE on every database table whose name starts with this site's table prefix, to reclaim unused space and defragment. Returns optimized (the count) and tables (the names). On large tables it can take a while and, depending on the storage engine, lock them meanwhile; there is no dry run. Requires manage_options.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.10.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, and the description goes well beyond that by disclosing table locking depending on storage engine, long runtime on large tables, absence of a dry run, and the manage_options capability requirement. It also describes the return payload (optimized count and table names), which is absent from structured data.

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?

Three tight sentences: what it does and on what scope, what it returns, then the risks and prerequisite. Risk and auth information is front-loaded before the agent commits, with no filler.

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?

No output schema exists, but the description covers the return shape, the capability gate, the non-reversibility (no dry run), and the performance/locking hazard. For a zero-parameter destructive maintenance tool, an agent has everything needed to decide and to set expectations.

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 and there is nothing for the description to disambiguate. The description correctly adds no parameter prose, keeping the focus on behavior.

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 the exact operation (OPTIMIZE TABLE), the exact scope (every table whose name starts with this site's table prefix), and the goal (reclaim space, defragment). An agent can immediately distinguish this from maintenance siblings like wp_cleanup_transients or wp_clear_cache without opening any schema.

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

Usage Guidelines4/5

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

Gives clear operating context — requires manage_options, no dry run, may be slow and may lock tables — which tells the agent when this is appropriate and what it costs. It stops short of explicitly naming alternatives (e.g., wp_cleanup_transients for lighter cleanup) or stating when not to run it, so it is strong context without explicit routing.

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