Skip to main content
Glama

codegraph

Index source code into a local SQLite database and perform symbol lookups, call hierarchy analysis, dead code detection, and more—no LLM calls required.

Instructions

AST-based code indexing and symbol lookup tool. Parses source code with tree-sitter (via WASM, no external dependencies) and stores symbols/relationships in a local SQLite index (.codegraph.db). Operations: index(path) - Build or update the code index for a project directory. find(name) - Find symbol definitions by name (function, class, method). callers(name) - Find all callers of a function/method. callees(name) - Find all functions/methods called by a function. symbols(path) - List all symbols in a file (no index needed). methods(name) - List all methods of a class. inherits(name) - Show inheritance hierarchy of a class. stats(path) - Project index statistics (files, classes, functions, calls). importers(path, name) - Find files that import/include a given file. unused(path) - Find symbols defined but never called (dead code). call_tree(name, depth, direction) - Recursive call hierarchy (up=callers, down=callees). Supports: C/C++, Python, Go, C#, Rust, Java. Index is stored at project root as .codegraph.db (add to .gitignore). Respects .gitignore (including nested) and skips non-source dirs (venv, vendor, third_party, etc.). No LLM calls, no embeddings -- pure data lookup, zero token cost. Tip: Run index once at the start of a session, then use find/callers/call_tree to navigate. Re-run index after bulk edits to update changed files (incremental, fast). Powered by tree-sitter (MIT) via wazero (pure Go WASM runtime).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesOperation: index, find, callers, callees, symbols, methods, inherits, stats, importers, unused, call_tree,required
pathNoProject directory path (for index) or file path (for symbols)
nameNoSymbol name to search for (for find, callers, callees, methods, inherits, call_tree)
languageNoLanguage hint: cpp, python, go, csharp, rust, java. Default: auto-detect from file extension
workersNoNumber of parallel parse workers for index operation. Default: 4. Higher = faster but more memory (~7MB per worker)
depthNoMax recursion depth for call_tree. Default: 3, Max: 10
directionNoDirection for call_tree: up (callers) or down (callees). Default: up
Behavior4/5

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

Discloses use of tree-sitter via WASM (no deps), local SQLite storage, .gitignore handling, and zero LLM token cost. Mentions memory per worker (7MB) and incremental indexing. No annotations provided, so description carries full burden; lacks error behavior but covers key traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is long but structured with bullet-style operation list. Front-loads core purpose, but the length could be trimmed for conciseness; still organized and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers operations and behavior well for a tool with 7 parameters and no output schema. However, lacks return format details (e.g., what find/callers output looks like). Agents need to infer output from operation names; could be more complete.

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?

Input schema has 100% description coverage with detailed parameter docs. The tool description adds context: workers' memory usage, depth max, direction defaults. The operation list in the description clarifies parameter usage 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 is an 'AST-based code indexing and symbol lookup tool' with a list of specific operations (index, find, callers, etc.). It distinguishes itself from siblings like grep or sloc by focusing on symbol navigation, not text search or counting.

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?

Includes a tip to run index at session start and re-index after bulk edits, guiding when to use index vs. search operations. Also notes .gitignore respect and directory skipping, but does not explicitly compare to alternatives or state when not to use.

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/knewstimek/agent-tool'

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