Skip to main content
Glama

create_index

Destructive

Add an index to a MySQL or MariaDB table to speed queries, with dry-run preview and a reversible undo. Supports unique indexes or a validated CREATE INDEX statement.

Instructions

[WRITE][risk=medium] Create an index. Reversible: undo drops the created index.

The created (table, name) is returned so the harness records an undo that drops exactly this index. Pass dry_run=True to preview. Alternatively pass definition (a captured CREATE INDEX statement — this is how drop_index's undo descriptor replays) INSTEAD of table/columns.

Args: table: Table to index (optionally schema-qualified). Required unless definition is given. columns: Column names to index. Required unless definition is given. name: Index name (auto-generated from table+columns when omitted). unique: Create a UNIQUE index. definition: A full CREATE [UNIQUE] INDEX statement to execute verbatim (shape-validated). Mutually exclusive with table/columns. dry_run: If True, preview without creating. target: Target name from config; omit for the default.

Input Schema

NameRequiredDescriptionDefault
nameNo
tableNo
targetNo
uniqueNo
columnsNo
dry_runNo
definitionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations carry readOnlyHint=false and destructiveHint=true already, but the description adds meaningful context beyond them: it is reversible via undo, the harness records an undo that drops exactly this index, and dry_run previews. The (table, name) return value contract is disclosed even without an output schema.

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 risk tag, then the undo contract, then the alternative mode, then a clean Args list. Slightly long but every section earns its place; no filler sentences.

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?

For a 7-param, zero-coverage, no-output-schema write tool, the description covers mode selection, reversibility, preview, and return value well. Minor gap: no explicit statement about failure modes (e.g. duplicate index name) or permission requirements.

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%, so the description must compensate, and it does: it documents every parameter's meaning, mutual exclusivity (definition vs table/columns), auto-generation of name, uniqueness semantics, and the optional target. This is exactly what an undocumented 7-param schema needs.

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+resource ('Create an index') and immediately differentiates from the sibling drop_index by naming it in the undo mechanics. The behavior tags [WRITE][risk=medium] and the reversibility statement let an agent place it precisely among DDL siblings.

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?

Explains the two mutually exclusive invocation modes (table/columns vs definition) and when to use each, plus dry_run for preview. Does not explicitly route against alternatives like optimize_table or analyze_table, but the mode selection guidance is clear.

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