Skip to main content
Glama

Query graph

query_graph
DestructiveIdempotent

Run 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

TableJSON Schema
NameRequiredDescriptionDefault
graphNoWhich graph to query: the code knowledge graph (default) or the missed graph (only files not fully indexed, laid out as their file structure).code
queryYesCypher query
projectYes
max_rowsNoOptional row limit. Default: unlimited up to a 100k row ceiling. No offset support — use search_graph for paginated browsing.
Behavior5/5

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

The description adds substantial behavioral context beyond annotations: the 100k row ceiling, node complexity properties (cyclomatic, cognitive, nested-loop depth, etc.), hot-path signals, and the semantics of the missed graph with its caveat about completeness. This is rich operational detail.

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

Conciseness5/5

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

The description is long but well-structured and every sentence contributes value: purpose, response shape, row limit, complexity properties, missed graph semantics, and examples. It uses headers and a readable flow, making it dense but not verbose.

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

Completeness5/5

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

Given the tool's complexity, the description is highly complete. It covers usage scenarios, limitations, alternative tools, graph variants, example queries, and the returned 'total' count. There is no output schema, but the description gives enough context with query examples and response details to guide invocation effectively.

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?

Schema coverage is 75%, and the description significantly enriches the graph parameter by explaining the missed graph structure and its purpose, and clarifies max_rows behavior (no offset, 100k ceiling). It also provides an example Cypher query demonstrating parameter usage, which adds depth beyond the schema fields, though some parameter-level detail (like query validation) is absent.

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 the tool executes a Cypher query against the knowledge graph for complex multi-hop patterns, aggregations, and cross-service analysis. It distinguishes itself from sibling search_graph by explicitly mentioning pagination alternatives and different use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit when-to-use guidance: complex patterns, aggregations, cross-service analysis. It also gives clear alternatives: use search_graph for paginated browsing or when row limits are exceeded, and explains when to use the missed graph. The 100k row ceiling is mentioned with mitigation instructions.

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/DeusData/codebase-memory-mcp'

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