Skip to main content
Glama

optimize_table

Eliminate table fragmentation by rebuilding tables to reclaim unused space and boost query performance, with dry-run preview.

Instructions

[WRITE][risk=medium] OPTIMIZE TABLE (rebuild, reclaim data_free). Records prior stats.

No undo (a rebuild has no inverse); the prior size/fragmentation stats are captured for the audit trail. InnoDB maps this to ALTER TABLE ... FORCE (online DDL, brief locks) — schedule off-peak for hot tables. Pass dry_run=True to preview.

Args: table: Table name (optionally schema-qualified, e.g. shop.orders). dry_run: If True, preview without running. target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYes
targetNo
dry_runNo
Behavior5/5

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

With no annotations, the description fully discloses the write nature, no-undo risk, audit trail of prior stats, InnoDB mapping to ALTER TABLE ... FORCE, and brief locks. This is exemplary transparency.

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 description is concise, front-loaded with purpose and risk, and uses a clear Args block. Every sentence adds value without filler or redundancy.

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?

The description covers operation, caveats, and parameters well. It falls just short of being complete by not specifying the return value or success message, but given no output schema this is a minor gap for a write tool.

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

Parameters5/5

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

Schema description coverage is 0%, but the Args section thoroughly explains every parameter: table format with schema qualification, dry_run semantics, and target default. It fully compensates for the missing schema coverage.

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?

Description clearly states 'OPTIMIZE TABLE (rebuild, reclaim data_free)' with specific action and resource, distinguishing it from read-only analysis tools like table_fragmentation. The purpose is unambiguous and not a tautology.

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?

Provides clear context: schedule off-peak for hot tables, use dry_run to preview, and notes the online DDL lock behavior. It does not explicitly name alternative tools for pure analysis, but the guidance is sufficient for correct usage.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AIops-tools/MySQL-AIops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server