Skip to main content
Glama

Query lessons for diff context

query_lessons
Read-onlyIdempotent

Retrieve the most relevant learning rules for a code diff to inform fixes and PRs, using bi-encoder retrieval and severity-weighted scoring.

Instructions

Retrieve the learning rules ("lessons") most relevant to a given code diff or PR context, packed within a token budget. Uses bi-encoder retrieval + severity-weighted scoring; pass the diff/description as the query and max_tokens (default 2000). Returns ranked { lessons: [{ title, rule, severity }] }. Read-only. Use before writing a fix or opening a PR; use list_lessons to browse all lessons unfiltered.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
top_kNoMax number of lessons to return (default 15, max 50).
diff_textYesThe PR diff, code snippet, or description of the change being made.
max_tokensNoMaximum tokens for returned lessons context (default 3000, max 8000).
project_idNoProject UUID. Defaults to configured project.
Behavior4/5

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

Annotations indicate read-only and idempotent. Description adds retrieval method (bi-encoder + severity-weighted scoring), token budget, and output format. However, it omits mention of the default value discrepancy for max_tokens (description says 2000, schema says 3000).

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?

Two sentences: first front-loads purpose, second adds technical detail and usage guidance. No wasted words.

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?

Given schema coverage and annotations, description explains output format and when to use. Lacks explanation of top_k and project_id, but schema covers them fully. Could briefly mention the ranking mechanism.

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

Parameters2/5

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

Schema has 100% coverage, so baseline is 3. Description adds context about token budget and retrieval method, but contradicts schema by stating max_tokens default is 2000 instead of 3000. This inconsistency reduces reliability for the agent.

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?

Clearly states the tool retrieves lessons relevant to a code diff or PR context, using specific verb 'retrieve' and resource 'lessons'. Distinguishes from sibling list_lessons by mentioning unfiltered browsing.

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 advises using this tool before writing a fix or opening a PR, and recommends list_lessons for browsing all lessons. Also specifies the query input as diff/description.

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/kensaurus/mushi-mushi'

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