Skip to main content
Glama

Build context

build_context
Read-only

Build a compact, prompt-ready context by retrieving relevant memories, prioritizing high-value ones, and trimming to a token budget for direct LLM input.

Instructions

Assemble a budgeted, prompt-ready context block for a query.

Highest-value memories first, with same-session neighbours pulled in, trimmed to token_budget. Drop the returned string straight into an LLM prompt. It uses lean memory lines by default; call recall or inspect_memory when you need full provenance/source evidence. Each line is dated and the header anchors today's date so the reader can resolve relative time. Standing user directives ("from now on…", "always…") are pinned in regardless of query relevance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
hybridNo
namespaceNo
token_budgetNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations declare readOnlyHint=true; description adds that it uses lean memory lines, dates, a header, and trims to token_budget. No contradictions. Additional context like 'highest-value memories first' and 'standing user directives pinned' provides useful behavioral insight beyond annotations.

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?

The description is a single compact paragraph, front-loaded with the core purpose. It could be slightly more structured (e.g., bullet points for usage notes) but remains efficient and clear without superfluous 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 the presence of an output schema and 5 parameters, the description covers the core behavior, output format, and key constraints (budget, date anchoring, directive pinning). It adequately prepares an agent to use the tool correctly, though minor details about parameter interactions could be added.

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 coverage is 0% so description should compensate; it explains the token_budget parameter's role ('trimmed to token_budget') but does not explain limit, hybrid, or namespace. Parameter names are intuitive but the description leaves ambiguity, particularly for 'hybrid'. Baseline 3 due to partial compensation.

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 tool assembles a budgeted, prompt-ready context block for a query, distinguishing it from sibling tools like recall and inspect_memory by specifying it returns a lean, dated string optimized for LLM prompts.

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 instructs when to use this tool (building context for a prompt) and when to use alternatives ('call recall or inspect_memory when you need full provenance/source evidence'), plus notes that standing directives are always included.

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/vornicx/Midas'

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