Skip to main content
Glama

query_graph

Read-onlyIdempotent

Combines dependency and reverse-dependency sets in one query-language expression, returning the modules, files, or count that match.

Instructions

Evaluates one expression of the query language over the graph and returns the modules, the files or the count it selects. Use it only to combine sets, which no other tool does: the modules that A uses within two hops and that use B directly are (files (intersect (deps "A" 2) (rdeps "B" 1))), where each number is how many hops to follow. For one plain question use list_dependencies (what a module uses, who uses it), find_definitions (a name), trace_calls (callers), analyze_impact (the reach of a change) or search_source (a text). expression is one expression; (help) returns the functions of the language with examples. A selection that holds nothing returns an empty result, not an error; a malformed expression (parentheses that do not match, an unknown function) returns one error line that says what is wrong. A long list stops at 200 items unless all is true.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "expression": "<expression>"
    },
    "name": "query_graph"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNoList everything instead of stopping at 200 items.
expressionYesA Scheme expression; (help) lists the functions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.15.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, closed-world behavior, but the description adds error and result semantics that annotations cannot express: empty selections return an empty result rather than an error, malformed expressions return a single error line naming the problem, and lists truncate at 200 unless `all` is true. It does not describe the exact result shape (modules vs files vs count), which is the main remaining gap.

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

Conciseness4/5

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

Front-loaded with the core action and the disambiguation, and the concrete example makes the language immediately usable. It is a single dense paragraph and mentions `(help)` twice (body and schema-echoed text), a small redundancy, but every other sentence carries necessary information.

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

Completeness4/5

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

For a flexible query-language tool with no output schema, the definition covers invocation, error behavior, truncation, and discoverability of the language, which is what an agent needs to call it correctly. The one omission is the concrete result shape (how modules/files/count are distinguished), which an agent would only learn by running it.

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 100%, so the baseline is 3; the description exceeds it by explaining the expression language itself, giving a worked example showing that numbers are hop counts, and pointing to `(help)` as a way to discover functions and examples. It adds real semantics beyond the schema's "A Scheme expression; (help) lists the functions."

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?

States a specific verb and resource: evaluates one expression of the query language over the graph and returns modules, files or a count. It also defines the tool's unique capability (combining sets) so an agent can distinguish it from all listed siblings without opening a schema.

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?

Explicitly scopes usage to combining sets, "which no other tool does," and then routes each plain question to the correct alternative by name and purpose (list_dependencies, find_definitions, trace_calls, analyze_impact, search_source). Both when-to-use and when-not-to-use are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.