Skip to main content
Glama

index_codebase

Index a codebase directory for semantic search. Extract AST code chunks, embed them locally, and store in a vector index, with incremental updates skipping unchanged files.

Instructions

Index a codebase directory for semantic search.

Walks the directory, extracts semantic code chunks using AST analysis,
embeds them locally with sentence-transformers, and stores in a vector index.
Subsequent calls skip unchanged files (incremental updates).

Args:
    path: Absolute path to the codebase root directory.
    force: If True, re-index all files even if unchanged.
    watch: If True, start a background watcher for live sync on file changes.
           Not supported with cloud providers (openai, voyage, gemini).
    provider: Embedding provider to use. One of: 'local' (default), 'openai',
              'voyage', 'gemini'. Cloud providers require the corresponding
              env var (VECGREP_OPENAI_KEY, VECGREP_VOYAGE_KEY, VECGREP_GEMINI_KEY)
              and optional dependency (pip install 'vecgrep[openai]' etc.).
              Once set, switching providers requires force=True to rebuild the index.

Returns:
    Summary: files indexed, chunks added, files skipped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
forceNo
watchNo
providerNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it reveals directory walking, AST-based chunking, local embedding, vector storage, incremental updates, background watching, and provider-specific requirements. It is not exhaustive about index location or destructive replacement, but it clearly discloses the main behaviors and side effects.

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 purpose is front-loaded and the Args/Returns sections are structured and scannable. The description is moderately long but each sentence contributes relevant behavioral or parameter information; only minor redundancy exists between the opening summary and later details.

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?

All parameters are explained, the return summary is identified, and important constraints such as incremental updates, provider switching, and watch limitations are covered. It could further clarify prerequisites or the relationship to sibling tools, but the output schema reduces the need to document return values in detail.

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%, and the Args section fully compensates for all four parameters. It adds path format (absolute), force semantics (re-index unchanged files), watch behavior and cloud-provider incompatibility, and provider enum values plus environment-variable and dependency requirements.

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 opening sentence clearly states the action ('Index'), the resource ('a codebase directory'), and the purpose ('for semantic search'). The description goes on to describe the core workflow, distinguishing it from sibling search and status tools by focusing on ingestion and vector index construction.

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

Usage Guidelines3/5

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

The description provides clear context for when indexing is relevant and explains incremental behavior and provider constraints. However, it never explicitly tells an agent when to choose this tool over siblings like index_graph, search_code, or get_index_status; the guidance is parameter-level rather than tool-selection guidance.

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

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/VecGrep/vecgrep'

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