Skip to main content
Glama

reindex_file_impl

Re-parses a C/C++ source file to update its symbols in the index, with optional full LLM analysis and method override regeneration. Allows incremental re-indexing without a full project rebuild.

Instructions

Re-parse a single source file with libclang and update its symbols in the index.

Shared implementation used by reindex_file (public tool, full analysis) and _auto_reindex_stale (background fast path, no LLM). Prefer reindex_file for interactive use; call this directly only when you need to control with_analysis explicitly.

Requires an existing index (fw-context index must have been run first). The file must appear in compile_commands.json — header-only files are re-indexed via the .cpp translation unit that includes them.

Args: file_path: Absolute or project-relative path to the source file to re-parse. Must have a matching entry in compile_commands.json. project_root: Project root directory. Auto-detected from cwd if omitted. with_analysis: When True (default), also regenerates LLM symbol analysis and method override relationships — slower but produces a fully up-to-date index. Set to False for a fast symbol-only update (used by background auto-reindex).

Returns: On success — dict with keys: file (str): Resolved absolute path to the re-indexed file. translation_units (int): Number of TUs that include this file. symbols_updated (int): Number of symbols written/updated. elapsed_s (float): Parse + store time in seconds. analysis_updated (int, optional): Symbol count with fresh LLM analysis (only present when LLM analysis is enabled and with_analysis=True). analysis_warning (str, optional): Reason LLM analysis was skipped. overrides_warning (str, optional): Reason override analysis was skipped. warning (str, optional): Header re-indexed via a single TU — other TUs including this header may still have stale symbols; run fw-context index for full accuracy. On error — dict with key: error (str): Human-readable reason (no index found, file not found, file not in compile_commands.json, no build config indexed).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute or project-relative path to the source file to re-parse. Must have a matching entry in compile_commands.json.
project_rootNoProject root directory. Auto-detected from cwd if omitted.
with_analysisNoWhen True (default), also regenerates LLM symbol analysis and method override relationships — slower but produces a fully up-to-date index. Set False for a fast symbol-only update (used by background auto-reindex).
Behavior5/5

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

Discloses that an existing index is required, header-only files are re-indexed via a .cpp TU, and explains behavior of 'with_analysis'. Also documents potential warnings and error return formats.

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?

Well-structured with clear sections, but the returns section is lengthy. Could be slightly more concise, but still effective.

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?

No output schema, but description thoroughly documents return values, prerequisites, edge cases, and distinguishes from sibling tools. Very complete for a complex tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but description adds context: file_path must match compile_commands.json, project_root auto-detected, and with_analysis explains trade-offs. Adds value beyond 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?

The description clearly states it re-parses a source file with libclang and updates symbols. It distinguishes from sibling tools by noting it's a shared implementation and that 'reindex_file' is preferred for interactive use.

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?

Explicitly tells when to use this tool vs 'reindex_file', when to set 'with_analysis' to False for fast updates, and states prerequisites (existing index, compile_commands.json).

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/turbyho/fw-context-mcp'

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