Skip to main content

Code Tools

These 5 tools work with indexed source code files (TypeScript/JavaScript). Graph Memory uses tree-sitter AST parsing to extract functions, classes, interfaces, type aliases, and other symbols from your source files.

info

These tools require the code graph to be enabled.

code_list_files​

Lists all indexed source code files.

Parameters​

ParameterRequiredDefaultDescription
filterNo—Substring filter on file path
limitNo—Maximum number of results

Returns​

Array of { fileId, symbolCount } — each entry is a source file with the number of symbols extracted from it.

When to use​

Get an overview of all indexed source files. Useful for understanding project structure.


code_get_file_symbols​

Lists all symbols in a source file, sorted by line number.

Parameters​

ParameterRequiredDescription
fileIdYesFile ID (e.g. "src/auth.ts")

Returns​

Array of { id, kind, name, signature, startLine, endLine, isExported } — every function, class, interface, and other symbol in the file.

When to use​

Get an outline of a file's structure, like an IDE's symbol panel. Use this before code_get_symbol to find the specific symbol you want to read.


Semantic search over code symbols with optional graph expansion.

Parameters​

ParameterRequiredDefaultDescription
queryYes—Search query (natural language)
topKNo5Number of seed results for BFS expansion
bfsDepthNo1How many hops to expand through graph connections
maxResultsNo5Maximum results returned
minScoreNo0.3Minimum relevance score (0-1)
bfsDecayNo0.8Score decay factor per BFS hop
searchModeNohybridhybrid, vector, or keyword
includeBodyNofalseInclude the full source body in results

Returns​

Array of { id, fileId, kind, name, signature, docComment, startLine, endLine, score, body? } — matching symbols ranked by relevance.

When to use​

The primary tool for finding code. Use natural language queries like "Find the function that handles password hashing" or "Where is the database connection configured?" Always prefer code_search over manually browsing files.


code_get_symbol​

Retrieves the full source body of a specific symbol.

Parameters​

ParameterRequiredDescription
nodeIdYesSymbol node ID (e.g. "src/auth.ts::hashPassword")

Returns​

{ id, fileId, kind, name, signature, docComment, body, startLine, endLine, isExported, crossLinks? } — the complete implementation including the full source code body and any cross-graph links.

When to use​

After code_search finds a relevant symbol, use code_get_symbol to read the full implementation. Node IDs follow the format fileId::symbolName.


code_search_files​

File-level semantic search over source files.

Parameters​

ParameterRequiredDefaultDescription
queryYes—Search query
limitNo10Maximum results
minScoreNo0.3Minimum relevance score

Returns​

Array of { fileId, symbolCount, score } — matching source files ranked by relevance.

When to use​

When you want to find which source files are relevant before drilling into individual symbols. This searches at the file level, while code_search searches at the symbol level.