Skip to main content
Glama

engram_context

Construct a formatted memory block for system prompts. Selects relevant memories by semantic query or top memories by frequency, truncates to fit token budget, and returns a single string in markdown, XML, JSON, or plain text.

Instructions

Build a single pre-formatted context block from relevant memories, ready to inject into a system prompt at session start. With a query it selects semantically relevant memories; with no query it returns the top memories by access frequency and recency. The block is rendered in the requested format and truncated to fit max_tokens. Returns: one formatted string (not an array) — contrast with engram_recall, which returns raw scored memory objects. Use when you want drop-in context text; use engram_recall when you need structured results to reason over.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum memories to include, 1–25 (default 10).
queryNoOptional query to select relevant memories. If omitted, returns top memories by access frequency and recency.
formatNoOutput format (default markdown): markdown=human-readable headings, xml=structured tags, json=machine-parseable, plain=raw text.markdown
namespaceNoNamespace to pull memories from (default "default").default
categoriesNoOptional list of memory types to include, e.g. ["preference", "fact"]; omit for all.
max_tokensNoApproximate token budget for the block; lower-priority memories are dropped to fit (default 1000).
include_metadataNoIf true, append each memory's id and confidence to the output (markdown and xml formats only). Default false.
Behavior5/5

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

Discloses key behaviors: semantic search with query, frequency/recency fallback, formatting options, token truncation, single string return. No annotations provided, but description covers all essential behavioral traits.

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?

Description is well-structured and concise: starts with main purpose, explains query/no-query, output format, sibling comparison, and usage guidance. No redundant sentences.

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 main functionality, usage guidelines, and parameter interplay. Lacks mention of error handling (e.g., no memories found), but given the tool's purpose and seven parameters, it is largely complete.

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 100%, but the description adds context on how parameters (e.g., limit, max_tokens, format) interact to produce the final block. Provides integration-level meaning beyond individual schema descriptions.

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?

Clearly states it builds a pre-formatted context block from memories, distinguishes from engram_recall by noting formatted string vs raw objects. Also describes behavior with and without query.

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 advises when to use this tool vs engram_recall: 'Use when you want drop-in context text; use engram_recall when you need structured results to reason over.' Also implies usage at session start.

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/HBarefoot/engram'

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