Skip to main content
Glama

query

Ask Datalog questions over a codebase to find dead code, clones, references, and dependencies; answers are labeled and can include derivations.

Instructions

One question in CE Datalog over the index's facts (ce.query-report schema): files, references, units, clones, mentions, path classes, with the built-in prelude (dead, reach, depends, same_dir, dir_ref) and the project's rules file; every answer labelled, its derivation under why; prelude answers the text a question builds on instead (ce.query-prelude schema: the prelude and the [rules.pack] program). Report-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whyNocarry every answer's derivation
bodyNothe question (`dead(F)`; `?-` and the final `.` optional); required unless `prelude`
fileNoa rules file (path relative to the root; default `[rules] file`, else ce.rules)
pathNosubpath (default: project root)
preludeNoanswer the prelude and the `[rules.pack]` program instead of a question

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.1/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It usefully discloses 'Report-only' (implying no mutation) and that every answer is labelled with its derivation under `why`. However, it omits any account of permissions, rate limits, failure behavior, or what happens to `path`/`file` defaults beyond what the schema already states.

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

Conciseness3/5

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

The purpose is front-loaded, but the single semicolon-and-parenthesis-laden sentence is dense and hard to parse, and it partially restates parameter behavior already in the schema. Structure is functional but overloaded rather than economical.

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

Completeness3/5

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

There is no output schema, so the description must cover returns; it names the ce.query-report and ce.query-prelude schemas and the labelled-answer format, which is helpful but refers to external schemas an agent cannot see. Combined with missing usage guidance and error behavior, the coverage is adequate but not complete for a 5-parameter tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all five parameters, making 3 the baseline. The description reinforces the `why` and `prelude` parameters and their semantics (prelude answers the prelude and `[rules.pack]` program instead of a question), adding marginal value but no syntax beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: answering one CE Datalog question over the index's enumerated fact types (files, references, units, clones, mentions, path classes). It is clear what the tool does, but it never distinguishes itself from siblings like rules, deadcode, graph_sites, or structure, which an agent could easily confuse with a generic 'query' tool.

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

Usage Guidelines2/5

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

There is no explicit when-to-use guidance and no alternatives are named, despite many plausible siblings (deadcode, clone, graph_sites, rules). The description explains modes (`prelude` vs a question) and the rules file, but not the context that should select this tool over another.

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