Skip to main content
Glama

compress_observations

Reduce token usage in session history by compressing raw observations into typed summaries. Marks items as compressed without deletion, letting you load project memory efficiently.

Instructions

Compress recent raw hook observations into structured typed summaries (tool_failure, tool_success, file_edit, generic) using rule-based analysis. Reduces token count when injecting session history into context. Does not delete raw observations — only marks them as compressed. Call before get_state or at session start to ensure hook data is compact before loading project memory. Returns the count of compressed items and a human-readable summary of what was processed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax number of raw observations to process. Default: 50.
sinceNoISO 8601 timestamp: only compress observations newer than this. Optional.
project_pathNoAbsolute path to the project root. Defaults to current working directory.
Behavior4/5

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

No annotations exist, so the description carries full disclosure burden. It critically states 'Does not delete raw observations — only marks them as compressed,' clarifying non-destructive behavior. Also specifies return value (count and summary). While it omits error handling and permissions, it covers the most crucial safety aspect.

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 concise for the information it conveys, front-loading the core action and types. All sentences contribute: purpose, usage timing, non-destructive note, and return value. It could be trimmed slightly but is well-structured.

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 its simple 3-param schema with full coverage and no output schema, the description sufficiently covers what the tool does, when to use it, safety implications, and return behavior. It is complete for the tool's complexity and distinct from all siblings.

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 100%, and the description adds little beyond schema definitions. The description does not elaborate on limit, since, or project_path beyond their names, so it meets the baseline but adds no extra semantic value.

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 action (compress) and resource (raw hook observations), specifies output types (tool_failure, tool_success, file_edit, generic), and differentiates from siblings like query_history and get_state. The purpose is unambiguous and actionable.

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?

Provides explicit timing guidance ('Call before get_state or at session start') and rationale (reduces token count before loading memory). Lacks explicit when-not-to-use or alternatives, but the context is clear enough to select this tool appropriately.

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/Fmarzochi/EGC'

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