Skip to main content
Glama

index_codebase

Builds a semantic search index for an entire codebase, running in background by default and returning a project overview while embeddings are generated.

Instructions

Indexes the entire codebase for semantic search.

Limited to 5000 files per operation. For large codebases use index_changed_files() instead.

By default runs in **background** mode: returns immediately with a project
structure overview while the heavy embedding work continues in a daemon thread.
Call `get_index_progress()` to poll completion status.

Args:
    force: If True, clears existing index before indexing.
    background: If True (default), runs indexing in a background thread and
                returns immediately with a project overview. If False, blocks
                until indexing is fully complete (old behaviour — may timeout
                on large codebases).

Returns:
    - background=True:  instant project structure overview + status line
    - background=False: final indexing stats string

Input Schema

NameRequiredDescriptionDefault
forceNo
backgroundNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.12.0

TDQS

A4.9/5.0
Behavior5/5

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

No annotations are provided, and the description carries the full burden well: it discloses the default background daemon-thread behavior, that it returns immediately while embedding continues, that force clears the existing index, and that blocking mode may timeout on large codebases. These are exactly the traits an agent needs before invoking a long-running mutation.

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 one-line purpose and the size limit, which is the right ordering. The trailing Returns section largely restates what the background arg paragraph already established, so there is some redundancy, but nothing is unclear.

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 two-param tool with no annotations, the description covers scope limits, default mode, side effects, timeout risk, return shape, and the progress-polling follow-up. Despite an output schema existing, the return description adds useful mode-specific differentiation.

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%, so the description must compensate, and it does: both parameters are explained with their defaults and consequences, including what force destroys and what flipping background changes in return value and blocking behavior. The schema's bare booleans would be ambiguous without this.

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 and resource ('Indexes the entire codebase') plus the purpose ('for semantic search'). The 'entire codebase' scope cleanly separates it from the sibling index_changed_files and search_codebase.

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

Usage Guidelines5/5

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

Gives an explicit alternative ('For large codebases use index_changed_files() instead') tied to a concrete threshold (5000 files per operation). It also names get_index_progress() as the polling follow-up and spells out when to pick background=False vs the default.

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