Skip to main content
Glama

create_index

Create an index on a PostgreSQL table to improve query performance. Supports concurrent non-blocking builds, unique indexes, and various methods.

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
Behavior5/5

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

Despite no annotations, the description discloses risk level ('medium'), WRITE nature, reversibility via undo, support for CONCURRENTLY, and dry-run preview. It also explains how the created name is returned for undo recording, offering comprehensive behavioral insight.

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?

The description is well-structured with a header, explanatory paragraphs, and a bullet list. While somewhat verbose, each sentence adds value. The length is justified by the number of parameters and complexity, but could be slightly tightened.

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?

Given the tool's complexity (9 parameters, no output schema, no schema descriptions), the description is remarkably complete. It covers both usage modes, behavioral traits, parameter dependencies, and even hints at return value ('created name is returned'). Only minor omissions like error handling or prerequisites.

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?

With 0% schema coverage, the description fully compensates by detailing each parameter's purpose, required combinations, mutual exclusivity of table/columns with definition, defaults (auto-generated name, btree method), and behavior (dry_run preview). All 9 parameters are thoroughly explained.

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?

The description clearly states it creates an index, distinguishes from drop_index and reindex by emphasizing creation and reversibility via undo. The verb 'Create' and resource 'index' are explicit.

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?

It provides clear context for when to use this tool (to create an index) and mentions an alternative mode using 'definition' for recreating indexes, which is related to drop_index's undo. However, it does not explicitly exclude usage when other tools like reindex would be more appropriate.

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/Postgres-AIops'

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