Skip to main content
Glama

index_graph

Build a structural knowledge graph of a codebase, extracting files, functions, classes, and their relationships to enable semantic code search and analysis.

Instructions

Build (or rebuild) a knowledge graph for a codebase.

Walks the directory using the same skip rules as index_codebase, extracts
structural nodes (files, functions, classes) and edges (contains, calls,
imports, inherits) using tree-sitter, and persists the graph to disk.

This is independent of the vector index — you can run index_graph before
or after index_codebase.

Args:
    path: Absolute path to the codebase root directory.
    force: If True, rebuild the graph even if one already exists.

Returns:
    Summary: node count, edge count, files processed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
forceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A4.6/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 transparency burden. It discloses that the tool walks the directory, extracts nodes/edges, persists the graph to disk, and supports a force rebuild if a graph already exists. Core side effects are visible, even if performance costs and error behavior are not detailed.

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?

The description is tightly organized: a one-line summary, a brief mechanism paragraph, and clear Args/Returns sections. No sentence is wasted, and key concepts like independence from the vector index and force behavior are front-loaded appropriately.

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?

The description covers the essential invocation context: path requirements, force behavior, return summary (node count, edge count, files processed), and relationship to index_codebase. With the output schema already available, no additional return-structure detail is needed.

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%, but the description fully compensates by explaining both parameters: path is 'the absolute path to the codebase root directory' and force means 'rebuild the graph even if one already exists.' This provides complete, actionable meaning beyond the bare schema types.

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 opens with a specific verb and resource: 'Build (or rebuild) a knowledge graph for a codebase.' It further names the extraction outputs (structural nodes and edges) and explicitly mentions tree-sitter, which distinguishes it from vector-index siblings like index_codebase. The agent can confidently identify what this tool does without guessing.

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?

The description gives clear context for how this tool relates to index_codebase ('same skip rules', 'independent of the vector index', 'run before or after'), which helps the agent understand ordering and sequencing. It does not explicitly say when to prefer this tool over graph query tools like search_graph or graph_neighbors, but it implies the build step clearly.

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