Skip to main content
Glama

query_lessons

Retrieve active lessons for a project across its scope hierarchy, filtering by area, tags, or free-text semantic search to surface relevant coding rules and lessons.

Instructions

Query active lessons 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 lessons.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
areaNoFilter by area_affected, e.g. 'deployment', 'performance', 'security'.
tagsNoComma-separated tags; matched by exact tag equality, not substring.
detailNo'summary': metadata only. 'full': also includes what_happened text (may return STALE_INDEX per row if its source file changed since indexing).summary
formatNoOutput format: 'json' or 'toon' (compact tabular).json
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 lessons. Only affects plain SQL filtering — deprecated lessons 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
Behavior3/5

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

With no annotations provided, the description carries the full burden and partially meets it by declaring 'Access level: read.' and that only 'active' lessons are returned. It stops short of disclosing pagination, result-size limits, or the STALE_INDEX caveat (which lives only in the schema), so important behavioral context is missing for a 7-param tool.

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 short paragraphs, well front-loaded: purpose first, then access level and return type. The 'Returns:' line is largely redundant given an output schema exists, but it costs little and the rest is waste-free.

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 complex tool with 100% schema coverage and an output schema, the description covers the scope hierarchy, both query modes, and read access — everything an agent needs to call it correctly. It omits only secondary operational details like limits, which the schema and output schema partially absorb.

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 is already documented in the schema; the baseline of 3 applies. The description echoes the query_text semantic-search trigger but adds no syntax, format, or interaction detail beyond what the schema already states.

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 (query) and resource (lessons) with scope: 'active lessons visible to a project across its full scope hierarchy (most-specific scope first)'. This distinguishes it cleanly from the sibling query_rules by resource and adds the ordering rule an agent needs.

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?

The description explains the two operating modes — plain SQL filtering versus semantic search 'when query_text is set and embeddings exist' — which is genuine mode-selection guidance. However, it gives no guidance on when to pick query_lessons over siblings like query_rules or get_rule_context, so tool selection is left implied.

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