Skip to main content
Glama

Retrieve relevant memory

assemble_context
Read-onlyIdempotent

Retrieve the memory entries that answer a question, within a token budget. REQUIRES A KEY. Send the returned 'context' to your language model INSTEAD of the whole history. This does not call a model itself — it selects what to send. The budget is a ceiling, not a target: selection stops where relevance runs out, often well below it. The response says how many entries were left behind and why. If the response has a 'budget_warning', the best match did not fit: call again with its suggested_token_budget.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "namespace": "<namespace>",
      "query": "<query>"
    },
    "name": "assemble_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesWhat you need context about.
reduceNoOpt-in (FAS L): shorten the assembled context with a small, local, task-agnostic model before it is returned, to lower your own model's token cost. Requires tenant consent for context_reduction (set via /api/v1/gdpr/consent) — otherwise the call is rejected with SAMTYCKE_KRAVS instead of silently ignoring the request. NOT query-aware: selection is driven by what is least informative in general, not by this query.
namespaceYes
token_budgetNo
target_tokensNoOnly relevant together with reduce=true. How many tokens the assembled context should be shortened to. Omit for a default halving of what was actually retrieved.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover the read-only/idempotent profile, and the description adds substantial context beyond them: auth is required ('REQUIRES A KEY'), the budget is a ceiling rather than a target with early stopping, the response reports how many entries were left behind and why, and reduce requires tenant consent or fails with SAMTYCKE_KRAVS. The budget_warning retry loop is exactly the kind of behavioral detail an agent cannot get from annotations or schema.

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?

Tight and front-loaded: purpose first, then consumption instruction, then budget semantics, then failure handling. Dense but every sentence carries information. The all-caps emphasis (REQUIRES A KEY, INSTEAD, NOT query-aware) is a stylistic cost rather than a length problem.

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?

With no output schema, the description does useful work describing the response (left-behind count with reasons, budget_warning). Auth, consent failure mode, and retry are all covered. The remaining gap is namespace, which is neither described in the schema nor in the description, so an agent must guess its role in scoping the memory lookup.

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 coverage is 60%, and the description compensates for the two undocumented parameters: token_budget is explained as a ceiling with early termination, and suggested_token_budget is tied to the budget_warning retry. namespace and the query parameter get no added explanation, and the reduce/target_tokens semantics largely restate 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?

States a specific verb and resource ('retrieve the memory entries') plus the scoping constraint (token budget, answer a question). It also pre-empts the most likely misreading by saying it does not call a model itself — it selects what to send. That distinguishes it cleanly from the write-side sibling remember without needing to name it.

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?

Gives clear operational guidance: send the returned 'context' to the model instead of the whole history, and retry with suggested_token_budget when a 'budget_warning' appears. What's missing is any explicit routing versus alternatives such as assemble_escalation_context or remember — the agent must infer which retrieval entry point to use when.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.