Skip to main content
Glama

query_corpus

Read-onlyIdempotent

Answer natural-language questions by querying a saved corpus. Returns the AI response or the assembled prompt when mode is prompt-only.

Instructions

Answer a natural-language question against a saved corpus. Loads the corpus body, primes the configured AI provider with it as system context, and returns the response. When mode="prompt-only" returns the assembled system+user prompt instead of calling the AI — useful for users without an AI provider configured, or for piping into another LLM. Returns JSON: { answer | prompt, corpus, tokens_used }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCorpus slug — alphanumeric + dash + underscore, ≤64 chars, must start with a letter or digit
questionYesNatural-language question
modeNoanswer (default): call the AI provider and return its reply; prompt-only: return the assembled prompt without calling the AI
max_tokensNoCap on the AI response length (default 1024)
temperatureNoSampling temperature for the AI call (default 0.2)
Behavior4/5

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

The description adds context beyond annotations by explaining that the tool loads the corpus body, primes the AI provider, and returns JSON with answer or prompt, corpus, and tokens_used. It does not contradict annotations (readOnlyHint, idempotentHint) and provides useful behavioral details.

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?

The description is concise at three sentences, with each sentence serving a distinct purpose: stating the main function, explaining the process, and detailing the mode and return format. It is front-loaded and contains no unnecessary text.

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

Completeness5/5

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

Given the complexity (5 parameters, no output schema), the description covers all key aspects: the main behavior, the two modes with specific use cases, the return format, and the process of loading and priming. It provides sufficient context for an AI agent to understand and invoke the tool correctly.

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 description coverage is 100%, so the baseline is 3. The description adds value by specifying the return format ({ answer | prompt, corpus, tokens_used }) and the default values for max_tokens and temperature, which are already in the schema but are reinforced. It does not describe each parameter beyond what schema provides, but the extra context justifies a 4.

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?

The description clearly states the verb (answer) and resource (natural-language question against a saved corpus), and distinguishes it from siblings by specifying it loads the corpus body and uses an AI provider. This is a specific and unambiguous purpose.

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

Usage Guidelines4/5

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

The description explicitly explains when to use the 'prompt-only' mode for users without an AI provider or for piping into another LLM. However, it does not provide guidance on when to use this tool versus other query tools like query_by_intent or search, leaving some ambiguity about alternatives.

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/nikolai-vysotskyi/trace-mcp'

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