MCP ServerTools
Cypher Query
Execute graph queries against the knowledge graph
Query your code knowledge graph using Cypher. Read-only operations only.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
repository | string | Yes | Repository name |
cypher | string | Yes | Cypher query (read-only) |
max_results | number | No | Max results (default: 10000) |
Common Queries
Find functions by name
MATCH (s:CODE_SYMBOL)
WHERE s.symbol_type = "Function"
AND s.name CONTAINS "user"
RETURN s.name, s.file_path
LIMIT 20Find callers of a function
MATCH (caller:CODE_SYMBOL)-[:CALLS]->(target:CODE_SYMBOL)
WHERE target.name = "authenticateUser"
RETURN caller.name, caller.file_pathTrace call chains
MATCH path = (start:CODE_SYMBOL)-[:CALLS*1..3]->(end:CODE_SYMBOL)
WHERE start.name = "handleRequest"
RETURN path
LIMIT 10Find cross-community calls
MATCH (s1:CODE_SYMBOL)-[:MEMBER_OF]->(c1:Community),
(s2:CODE_SYMBOL)-[:MEMBER_OF]->(c2:Community),
(s1)-[:CALLS]->(s2)
WHERE c1 <> c2
RETURN c1.label, c2.label, count(*) as calls
ORDER BY calls DESCList high-cohesion communities
MATCH (c:Community)
WHERE c.cohesion > 0.8
RETURN c.label, c.cohesion, c.symbol_count
ORDER BY c.cohesion DESCTips
- Always use
LIMITto avoid large result sets - Filter early with
WHEREfor better performance - Specify node labels (
CODE_SYMBOL,File,Community,Process)
Depth in Cypher Queries
Unlike higher-level tools with a depth parameter, Cypher queries give you full control over what data you retrieve:
| To get... | Query pattern |
|---|---|
| Symbols only | MATCH (s:CODE_SYMBOL) RETURN s.name, s.content |
| Symbols + callers | MATCH (caller)-[:CALLS]->(s:CODE_SYMBOL) RETURN s, caller |
| Symbols + callees | MATCH (s:CODE_SYMBOL)-[:CALLS]->(callee) RETURN s, callee |
| Full relationships | MATCH (s:CODE_SYMBOL)-[r]->(target) RETURN s, r, target |
Write operations (CREATE, DELETE, SET) are blocked.
Related
- Database Schema - Node types and properties
- Graph Debugging - Debugging workflows