Skip to main content
Glama

create_index

Destructive

Create an index on a PostgreSQL table to speed queries, with optional CONCURRENTLY builds that avoid locking, dry-run previews, and reversible undo.

Instructions

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

Supports CONCURRENTLY (non-blocking build). The created 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 pg_get_indexdef
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.
    concurrently: Build with CONCURRENTLY (no table lock).
    method: Index method — btree/hash/gist/gin/brin/spgist (default btree).
    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

TableJSON Schema
NameRequiredDescriptionDefault
nameNo
tableNo
methodNo
targetNo
uniqueNo
columnsNo
dry_runNo
definitionNo
concurrentlyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, but the description adds substantial context beyond them: reversibility via a recorded undo ('undo drops the created name'), the CONCURRENTLY non-blocking trait, dry-run preview, and shape validation on definition. This is real behavioral disclosure the annotations do not carry.

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?

Front-loads the operation, risk level, and reversibility, then uses a clean Args block. Given 9 parameters and zero schema coverage, every sentence earns its place 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?

For a 9-parameter write tool with no output schema and no schema descriptions, the definition covers inputs, behavioral traits, reversibility, preview mode, and even the return value ('the created name is returned'). Nothing an agent needs to call it correctly is missing.

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 coverage is 0% and the schema only carries titles/defaults, so the description must compensate. It documents all 9 parameters with meaning: schema-qualified table, auto-generated name, the btree/hash/gist/gin/brin/spgist method list (an enum not present in the schema), and the mutual exclusivity of definition vs table/columns. This adds meaning well beyond the raw schema.

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') with an explicit [WRITE][risk=medium] tag and the reversible undo semantics. It also implicitly separates itself from drop_index and reindex siblings by describing the recursive undo relationship.

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 selection guidance for its own options: CONCURRENTLY for non-blocking builds, dry_run=True to preview, and 'definition INSTEAD of table/columns' as the mutually exclusive alternative. It lacks any explicit when-not-to-use or routing to reindex/drop_index, so it stops short of a full 5.

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