Skip to main content
Glama

query_rules

Retrieve active coding rules for a project across its scope hierarchy using SQL filters or semantic search when a text query is set.

Instructions

Query active rules visible to a project across its full scope hierarchy (most-specific scope first), via plain SQL filtering or — when query_text is set and embeddings exist — semantic search.

Access level: read. Returns: a JSON or TOON array of matching rules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagsNoComma-separated tags; matched by exact tag equality, not substring.
detailNo'summary': metadata only. 'full': also includes rule text (may return STALE_INDEX per row if its source file changed since indexing).summary
formatNoOutput format: 'json' or 'toon' (compact tabular).json
categoryNoFilter by rule category, e.g. 'quality', 'security', 'architecture'.
severityNoFilter by severity: 'low' | 'medium' | 'high' | 'critical'.
project_idYesProject id (with or without the 'project-' prefix).
query_textNoFree-text query. When set and ChromaDB has embeddings, enables semantic (RAG) search instead of plain SQL filtering.
include_deprecatedNoInclude deprecated rules. Only affects plain SQL filtering — deprecated rules are removed from the semantic (query_text) index on deprecation, so this does not revive them there.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations present, the description carries the full burden and does disclose meaningful behavior: 'Access level: read' establishes the safety profile, the scope-hierarchy ordering rule explains result precedence, and the embeddings-must-exist caveat explains silent fallback to SQL. It stops short of noting result caps, pagination, or performance characteristics of the semantic path.

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?

Two sentences plus a short returns line, with the core purpose front-loaded and no filler. The 'Access level: read' and 'Returns:' fragments are slightly label-like but each carries information rather than padding.

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 an 8-parameter read-only query tool with 100% schema coverage and an output schema, the description covers the essentials: purpose, scope resolution order, dual query mode, access level, and return shape. Nothing critical is missing, though the absence of any guidance tying it to its many sibling read tools leaves a small gap.

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 every parameter including tags, detail, format, category, severity, query_text, and include_deprecated is already documented in the schema, often with more nuance than the description. The description's only added semantic is the query_text/SQL-vs-semantic framing, which the schema already states, so the baseline 3 applies.

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 (query) and resource (active rules) plus the scope semantics ('visible to a project across its full scope hierarchy, most-specific scope first'), which is genuinely distinguishing detail. It does not, however, name or contrast with the obvious sibling query_lessons or check_feature_against_rules, so an agent must infer the boundary from the resource noun alone.

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

Usage Guidelines3/5

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

It implies when the tool applies (querying rules scoped to a project) and gives one conditional trigger — 'when query_text is set and embeddings exist' switches to semantic search. But it never states when to prefer this over get_rule_context, get_rule_timeline, or query_lessons, and there are no exclusions or prerequisites beyond that single mode switch.

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