Skip to main content
Glama

context

Compiles active facts, preferences, and rules into prompt-ready Markdown within a character budget for AI agent prompts, controlling memory size.

Instructions

Compile active facts, preferences, and rules into prompt-ready Markdown within a character budget. Use for agent context; use list_facts to inspect individual records. Project scope requires initialized project memory; global scope excludes project content. Persists a generated summary and audit event, so repeated calls create new records even with identical arguments. Returns context_markdown, included fact IDs, size information, and the summary metadata.

Input Schema

NameRequiredDescriptionDefault
scopeNoStorage scope: project uses this workspace; global uses user memory. Defaults to project.project
max_size_charsNoMaximum compiled Markdown length in characters, including headings. Defaults to 4000; values below the 110-character template minimum fail.
agent_session_keyNoOptional caller session correlation key included in the audit event. Omitted leaves it unset; do not include secrets.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.6.4
    • addedInput schema / properties / agent_session_key / description
      Added value: +"Optional caller session correlation key included in the audit event. Omitted leaves it unset; do not include secrets."
    • addedInput schema / properties / max_size_chars / description
      Added value: +"Maximum compiled Markdown length in characters, including headings. Defaults to 4000; values below the 110-character template minimum fail."
    • addedInput schema / properties / scope / description
      Added value: +"Storage scope: project uses this workspace; global uses user memory. Defaults to project."
  2. First observedv0.4.0

TDQS

A4.8/5.0
Behavior5/5

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

The annotations already declare readOnlyHint=false and idempotentHint=false; the description explains what those hints mean in practice by disclosing that it persists a generated summary and audit event, so repeated calls create new records even with identical arguments. It also adds a precondition (initialized project memory for project scope) and the failure condition for the size budget. That is real behavioral context beyond the structured fields, and none of it contradicts the annotation set.

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?

Four tight sentences, front-loaded with the core action and immediately followed by the routing guidance. The final sentence enumerating return fields is largely redundant with the output schema, which is a minor waste, but everything else earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a write-side tool with persistence and audit side effects, the description covers the essentials an agent needs: prerequisites, scope exclusions, non-idempotency, and the size floor failure mode. With 100% schema coverage, an output schema, and annotations already present, nothing further is required.

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 description coverage is 100%, so the baseline is 3, and the description earns credit above that by explaining the operational consequence of scope (project requires initialized project memory; global excludes project content), which the schema does not state. The character budget is described as a compilation constraint rather than a mere parameter, reinforcing the max_size_chars semantics. It does not add anything about agent_session_key beyond the schema's own warning.

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 definition opens with a concrete verb and resource: 'Compile active facts, preferences, and rules into prompt-ready Markdown within a character budget.' It also distinguishes itself from the sibling it could be confused with, list_facts, by stating that list_facts is for inspecting individual records. An agent can select between them without opening either schema.

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?

It states the intended use case ('Use for agent context'), names the alternative tool and its purpose ('use list_facts to inspect individual records'), and specifies scope preconditions ('Project scope requires initialized project memory; global scope excludes project content'). Both the when and the when-not are explicit.

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