Codebase Memory MCP — Tool Reference
Tools (14 total)
| Tool |
Purpose |
index_repository |
Parse and ingest repo into graph (only once — auto-sync keeps it fresh) |
index_status |
Check indexing status (ready/indexing/not found) |
list_projects |
List all indexed projects with timestamps and counts |
delete_project |
Remove a project from the graph |
search_graph |
Structured search with filters (name, label, degree, file pattern) |
search_code |
Grep-like text search within indexed project files |
trace_call_path |
BFS call chain traversal (exact name match required). Supports risk_labels=true for impact classification. |
detect_changes |
Map git diff to affected symbols + blast radius with risk scoring |
query_graph |
Cypher-like graph queries (200-row cap) |
get_graph_schema |
Node/edge counts, relationship patterns |
get_code_snippet |
Read source code by qualified name |
read_file |
Read any file from indexed project |
list_directory |
List files/directories with glob filter |
ingest_traces |
Ingest OpenTelemetry traces to validate HTTP_CALLS edges |
Edge Types
| Type |
Meaning |
CALLS |
Direct function call within same service |
HTTP_CALLS |
Synchronous cross-service HTTP request |
ASYNC_CALLS |
Async dispatch (Cloud Tasks, Pub/Sub, SQS, Kafka) |
IMPORTS |
Module/package import |
DEFINES / DEFINES_METHOD |
Module/class defines a function/method |
HANDLES |
Route node handled by a function |
IMPLEMENTS |
Type implements an interface |
OVERRIDE |
Struct method overrides an interface method |
USAGE |
Read reference (callback, variable assignment) |
FILE_CHANGES_WITH |
Git history change coupling |
CONTAINS_FILE / CONTAINS_FOLDER / CONTAINS_PACKAGE |
Structural containment |
Node Labels
Project, Package, Folder, File, Module, Class, Function, Method, Interface, Enum, Type, Route
Qualified Name Format
<project>.<path_parts>.<name> — file path with / replaced by ., extension removed.
Examples:
myproject.cmd.server.main.HandleRequest (Go)
myproject.services.orders.ProcessOrder (Python)
myproject.src.components.App.App (TypeScript)
Use search_graph to discover qualified names, then pass them to get_code_snippet.
Cypher Subset (for query_graph)
Supported:
MATCH with node labels and relationship types
- Variable-length paths:
-[:CALLS*1..3]->
WHERE with =, <>, >, <, >=, <=, =~ (regex), CONTAINS, STARTS WITH
WHERE with AND, OR, NOT
RETURN with property access, COUNT(x), DISTINCT
ORDER BY with ASC/DESC
LIMIT
- Edge property access:
r.confidence, r.url_path, r.coupling_score
Not supported: WITH, COLLECT, SUM, CREATE/DELETE/SET, OPTIONAL MATCH, UNION
Common Cypher Patterns
# Cross-service HTTP calls with confidence
MATCH (a)-[r:HTTP_CALLS]->(b) RETURN a.name, b.name, r.url_path, r.confidence LIMIT 20
# Filter by URL path
MATCH (a)-[r:HTTP_CALLS]->(b) WHERE r.url_path CONTAINS '/orders' RETURN a.name, b.name
# Interface implementations
MATCH (s)-[r:OVERRIDE]->(i) RETURN s.name, i.name LIMIT 20
# Change coupling
MATCH (a)-[r:FILE_CHANGES_WITH]->(b) WHERE r.coupling_score >= 0.5 RETURN a.name, b.name, r.coupling_score
# Functions calling a specific function
MATCH (f:Function)-[:CALLS]->(g:Function) WHERE g.name = 'ProcessOrder' RETURN f.name LIMIT 20
Regex-Powered Search (No Full-Text Index Needed)
search_graph and search_code support full Go regex, making full-text search indexes unnecessary. Regex patterns provide precise, composable queries that cover all common discovery scenarios:
search_graph — name_pattern / qn_pattern
| Pattern |
Matches |
Use case |
.*Handler$ |
names ending in Handler |
Find all handlers |
(?i)auth |
case-insensitive "auth" |
Find auth-related symbols |
get|fetch|load |
any of three words |
Find data-loading functions |
^on[A-Z] |
names starting with on + uppercase |
Find event handlers |
.*Service.*Impl |
Service...Impl pattern |
Find service implementations |
^(Get|Set|Delete) |
CRUD prefixes |
Find CRUD operations |
.*_test$ |
names ending in _test |
Find test functions |
.*\\.controllers\\..* |
qn_pattern for directory scoping |
Scope to controllers dir |
search_code — regex=true
| Pattern |
Matches |
Use case |
TODO|FIXME|HACK |
multi-pattern scan |
Find tech debt markers |
(?i)password|secret|token |
case-insensitive secrets |
Security scan |
func\\s+Test |
Go test functions |
Find test entry points |
api[._/]v[0-9] |
API version references |
Find versioned API usage |
import.*from ['"]@ |
scoped npm imports |
Find package imports |
Combining Filters for Surgical Queries
# Find unused auth handlers
search_graph(name_pattern="(?i).*auth.*handler.*", max_degree=0, exclude_entry_points=true)
# Find high fan-out functions in the services directory
search_graph(qn_pattern=".*\\.services\\..*", min_degree=10, relationship="CALLS", direction="outbound")
# Find all route handlers matching a URL pattern
search_code(pattern="(?i)(POST|PUT).*\\/api\\/v[0-9]\\/orders", regex=true)
Critical Pitfalls
search_graph(relationship="HTTP_CALLS") does NOT return edges — it filters nodes by degree. Use query_graph with Cypher to see actual edges.
query_graph has a 200-row cap before aggregation — COUNT queries silently undercount on large codebases. Use search_graph with min_degree/max_degree for counting.
trace_call_path needs exact names — use search_graph(name_pattern=".*Partial.*") first to discover names.
direction="outbound" misses cross-service callers — use direction="both" for full context.
Decision Matrix
| Question |
Use |
| Who calls X? |
trace_call_path(direction="inbound") |
| What does X call? |
trace_call_path(direction="outbound") |
| Full call context |
trace_call_path(direction="both") |
| Find by name pattern |
search_graph(name_pattern="...") |
| Dead code |
search_graph(max_degree=0, exclude_entry_points=true) |
| Cross-service edges |
query_graph with Cypher |
| Impact of local changes |
detect_changes() |
| Risk-classified trace |
trace_call_path(risk_labels=true) |
| Text search |
search_code or Grep |
1---2name: codebase-memory-reference3description: This skill should be used when the user asks about "codebase-memory-mcp tools", "graph query syntax", "Cypher query examples", "edge types", "how to use search_graph", "query_graph examples", or needs reference documentation for the codebase knowledge graph tools.4---56# Codebase Memory MCP — Tool Reference78## Tools (14 total)910| Tool | Purpose |11|------|---------|12| `index_repository` | Parse and ingest repo into graph (only once — auto-sync keeps it fresh) |13| `index_status` | Check indexing status (ready/indexing/not found) |14| `list_projects` | List all indexed projects with timestamps and counts |15| `delete_project` | Remove a project from the graph |16| `search_graph` | Structured search with filters (name, label, degree, file pattern) |17| `search_code` | Grep-like text search within indexed project files |18| `trace_call_path` | BFS call chain traversal (exact name match required). Supports `risk_labels=true` for impact classification. |19| `detect_changes` | Map git diff to affected symbols + blast radius with risk scoring |20| `query_graph` | Cypher-like graph queries (200-row cap) |21| `get_graph_schema` | Node/edge counts, relationship patterns |22| `get_code_snippet` | Read source code by qualified name |23| `read_file` | Read any file from indexed project |24| `list_directory` | List files/directories with glob filter |25| `ingest_traces` | Ingest OpenTelemetry traces to validate HTTP_CALLS edges |2627## Edge Types2829| Type | Meaning |30|------|---------|31| `CALLS` | Direct function call within same service |32| `HTTP_CALLS` | Synchronous cross-service HTTP request |33| `ASYNC_CALLS` | Async dispatch (Cloud Tasks, Pub/Sub, SQS, Kafka) |34| `IMPORTS` | Module/package import |35| `DEFINES` / `DEFINES_METHOD` | Module/class defines a function/method |36| `HANDLES` | Route node handled by a function |37| `IMPLEMENTS` | Type implements an interface |38| `OVERRIDE` | Struct method overrides an interface method |39| `USAGE` | Read reference (callback, variable assignment) |40| `FILE_CHANGES_WITH` | Git history change coupling |41| `CONTAINS_FILE` / `CONTAINS_FOLDER` / `CONTAINS_PACKAGE` | Structural containment |4243## Node Labels4445`Project`, `Package`, `Folder`, `File`, `Module`, `Class`, `Function`, `Method`, `Interface`, `Enum`, `Type`, `Route`4647## Qualified Name Format4849`<project>.<path_parts>.<name>` — file path with `/` replaced by `.`, extension removed.5051Examples:52- `myproject.cmd.server.main.HandleRequest` (Go)53- `myproject.services.orders.ProcessOrder` (Python)54- `myproject.src.components.App.App` (TypeScript)5556Use `search_graph` to discover qualified names, then pass them to `get_code_snippet`.5758## Cypher Subset (for query_graph)5960**Supported:**61- `MATCH` with node labels and relationship types62- Variable-length paths: `-[:CALLS*1..3]->`63- `WHERE` with `=`, `<>`, `>`, `<`, `>=`, `<=`, `=~` (regex), `CONTAINS`, `STARTS WITH`64- `WHERE` with `AND`, `OR`, `NOT`65- `RETURN` with property access, `COUNT(x)`, `DISTINCT`66- `ORDER BY` with `ASC`/`DESC`67- `LIMIT`68- Edge property access: `r.confidence`, `r.url_path`, `r.coupling_score`6970**Not supported:** `WITH`, `COLLECT`, `SUM`, `CREATE/DELETE/SET`, `OPTIONAL MATCH`, `UNION`7172## Common Cypher Patterns7374```75# Cross-service HTTP calls with confidence76MATCH (a)-[r:HTTP_CALLS]->(b) RETURN a.name, b.name, r.url_path, r.confidence LIMIT 207778# Filter by URL path79MATCH (a)-[r:HTTP_CALLS]->(b) WHERE r.url_path CONTAINS '/orders' RETURN a.name, b.name8081# Interface implementations82MATCH (s)-[r:OVERRIDE]->(i) RETURN s.name, i.name LIMIT 208384# Change coupling85MATCH (a)-[r:FILE_CHANGES_WITH]->(b) WHERE r.coupling_score >= 0.5 RETURN a.name, b.name, r.coupling_score8687# Functions calling a specific function88MATCH (f:Function)-[:CALLS]->(g:Function) WHERE g.name = 'ProcessOrder' RETURN f.name LIMIT 2089```9091## Regex-Powered Search (No Full-Text Index Needed)9293`search_graph` and `search_code` support full Go regex, making full-text search indexes unnecessary. Regex patterns provide precise, composable queries that cover all common discovery scenarios:9495### search_graph — name_pattern / qn_pattern9697| Pattern | Matches | Use case |98|---------|---------|----------|99| `.*Handler$` | names ending in Handler | Find all handlers |100| `(?i)auth` | case-insensitive "auth" | Find auth-related symbols |101| `get\|fetch\|load` | any of three words | Find data-loading functions |102| `^on[A-Z]` | names starting with on + uppercase | Find event handlers |103| `.*Service.*Impl` | Service...Impl pattern | Find service implementations |104| `^(Get\|Set\|Delete)` | CRUD prefixes | Find CRUD operations |105| `.*_test$` | names ending in _test | Find test functions |106| `.*\\.controllers\\..*` | qn_pattern for directory scoping | Scope to controllers dir |107108### search_code — regex=true109110| Pattern | Matches | Use case |111|---------|---------|----------|112| `TODO\|FIXME\|HACK` | multi-pattern scan | Find tech debt markers |113| `(?i)password\|secret\|token` | case-insensitive secrets | Security scan |114| `func\\s+Test` | Go test functions | Find test entry points |115| `api[._/]v[0-9]` | API version references | Find versioned API usage |116| `import.*from ['"]@` | scoped npm imports | Find package imports |117118### Combining Filters for Surgical Queries119120```121# Find unused auth handlers122search_graph(name_pattern="(?i).*auth.*handler.*", max_degree=0, exclude_entry_points=true)123124# Find high fan-out functions in the services directory125search_graph(qn_pattern=".*\\.services\\..*", min_degree=10, relationship="CALLS", direction="outbound")126127# Find all route handlers matching a URL pattern128search_code(pattern="(?i)(POST|PUT).*\\/api\\/v[0-9]\\/orders", regex=true)129```130131## Critical Pitfalls1321331. **`search_graph(relationship="HTTP_CALLS")` does NOT return edges** — it filters nodes by degree. Use `query_graph` with Cypher to see actual edges.1342. **`query_graph` has a 200-row cap** before aggregation — COUNT queries silently undercount on large codebases. Use `search_graph` with `min_degree`/`max_degree` for counting.1353. **`trace_call_path` needs exact names** — use `search_graph(name_pattern=".*Partial.*")` first to discover names.1364. **`direction="outbound"` misses cross-service callers** — use `direction="both"` for full context.137138## Decision Matrix139140| Question | Use |141|----------|-----|142| Who calls X? | `trace_call_path(direction="inbound")` |143| What does X call? | `trace_call_path(direction="outbound")` |144| Full call context | `trace_call_path(direction="both")` |145| Find by name pattern | `search_graph(name_pattern="...")` |146| Dead code | `search_graph(max_degree=0, exclude_entry_points=true)` |147| Cross-service edges | `query_graph` with Cypher |148| Impact of local changes | `detect_changes()` |149| Risk-classified trace | `trace_call_path(risk_labels=true)` |150| Text search | `search_code` or Grep |