Skip to main content
Glama

build_context

Retrieves and compresses relevant memory from a knowledge graph into a compact context pack, resolving conflicts and staying within a token budget for the current task.

Instructions

Recursively retrieves and compresses relevant Waggle memory for the current task, using graph, hybrid, transcript, update, and conflict-aware retrieval. Decomposes the query into targeted subqueries, expands the graph around key nodes, resolves contradictions and superseded memories, and returns a compact context pack under a configurable token budget. Aliases: recursive_context, assemble_context, rlm_context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoRetrieval depth mode: 'fast' runs fewer subqueries for low latency; 'balanced' is the default; 'deep' adds extra subqueries for thorough coverage.balanced
depthNoGraph expansion depth around retrieved nodes.
queryYesCurrent user task or question to build context for.
projectNoOptional project or workspace name used to partition memory.
agent_idNoOptional agent or client identifier used to partition memory.
session_idNoOptional conversation or run identifier used to partition memory.
token_budgetNoMaximum token budget for the context pack (approximate).
max_subqueriesNoMaximum number of decomposed subqueries to run.
include_evidenceNoWhether to include verbatim transcript evidence in the context pack.
context_window_idNoOptional context window ID to focus retrieval within an existing window.
Behavior4/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It discloses several key behaviors: recursive retrieval, compression, subquery decomposition, graph expansion, contradiction resolution, and token budgeting. However, it does not mention potential side effects on persistent memory (e.g., whether it mutates stored data), leaving some ambiguity.

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, two sentences long, and front-loads the main purpose. It includes an alias list for discoverability. Every sentence serves a purpose, describing the what, how, and output without redundancy.

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 tool with 10 parameters and no output schema, the description provides a solid high-level understanding of the retrieval process and output type (compact context pack). However, it does not specify the exact structure of the context pack or detail how parameters like project/agent_id/session_id are used, which might be needed for correct invocation in complex scenarios.

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?

The schema has 100% parameter description coverage, so the baseline is 3. The description adds some context by referring to subqueries (max_subqueries), graph expansion depth (depth), and token budget, but it does not explain each parameter in detail beyond what the schema already provides. It adds minimal value beyond the schema.

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's primary function: 'Recursively retrieves and compresses relevant Waggle memory for the current task.' It differentiates from siblings by detailing graph, hybrid, transcript, update, and conflict-aware retrieval, and explicitly mentions returning a context pack. This makes the tool's unique role obvious.

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 implies usage for building context for the current task, but does not explicitly state when to use this tool over siblings like query_graph or prime_context. It lacks 'use this when' or 'do not use for' guidance, so an agent must infer from the description alone.

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/Abhigyan-Shekhar/Waggle-mcp'

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