Skip to main content
Glama

query_corpus

Read-onlyIdempotent

Answer natural-language questions against a saved corpus by querying an AI provider. Optionally return the assembled prompt instead for use with other LLMs.

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?

Annotations already indicate read-only, not destructive, idempotent. Description adds procedural details (loads corpus, primes AI, returns JSON) and explains mode behavior. No contradictions.

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?

Three well-structured sentences: purpose, process, mode details. No unnecessary words, front-loaded with key information.

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?

Covers return format, both modes, overall behavior. Lacks error handling or prerequisites (e.g., corpus must exist), but given no output schema, provides sufficient context for the tool's function.

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 covers all parameters with descriptions. Description does not add further parameter-level detail beyond the schema, achieving baseline.

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?

Description clearly states it answers natural-language questions against a saved corpus, loads the corpus, primes AI provider, and returns response. Explains two modes, distinguishing it from other tools like search or query_by_intent.

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?

Describes when to use 'prompt-only' mode (users without AI provider, piping to another LLM), but does not compare to sibling search tools or specify prerequisites like corpus existence.

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