Query graph
query_graphRun Cypher queries against the code knowledge graph to uncover complex patterns, hot-path risks, and unindexed files.
Instructions
Execute a Cypher query against the knowledge graph for complex multi-hop patterns, aggregations, and cross-service analysis. The response includes 'total' (returned row count). There is a hard 100k row ceiling — for broad queries add LIMIT in the Cypher itself or use search_graph + offset/limit pagination instead. COMPLEXITY / BOTTLENECKS: every Function and Method node carries queryable complexity properties — cyclomatic (complexity), cognitive, loop_count, loop_depth (max nested-loop depth, a polynomial-degree proxy), plus interprocedural transitive_loop_depth (worst-case nested-loop degree propagated along CALLS edges) and a recursive flag. Additional hot-path signals: linear_scan_in_loop (count of find/contains/indexOf-style scans inside a loop — the hidden O(n^2) that loop_depth misses), alloc_in_loop (allocations/appends inside a loop), recursion_in_loop (a self-call inside a loop), unguarded_recursion (recursion with no conditionally-guarded base case), param_count and max_access_depth (structure smells). Find all hot-path candidates in one query, e.g. MATCH (f:Function) WHERE f.transitive_loop_depth >= 3 OR f.linear_scan_in_loop >= 1 RETURN f.qualified_name, f.transitive_loop_depth, f.linear_scan_in_loop ORDER BY f.transitive_loop_depth DESC. MISSED GRAPH: pass graph="missed" to query the best-effort miss graph instead — the file structure of ONLY the files the indexer could NOT fully index (Project → Folder → File nodes with CONTAINS_FOLDER/CONTAINS_FILE edges; each File carries kind ("parse_partial" = indexed but constructs in the flagged line ranges MAY be missing; or a skip phase) and detail (the line ranges / reason)). Example: MATCH (f:File) WHERE f.kind = "parse_partial" RETURN f.file_path, f.detail. Absence from this graph is NOT a completeness guarantee.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph | No | Which graph to query: the code knowledge graph (default) or the missed graph (only files not fully indexed, laid out as their file structure). | code |
| query | Yes | Cypher query | |
| project | Yes | ||
| max_rows | No | Optional row limit. Default: unlimited up to a 100k row ceiling. No offset support — use search_graph for paginated browsing. |