Skip to main content
Glama

memento_compact

Compress natural-language text to save tokens while preserving code, URLs, and file paths. Applies rule-based strategies to fit text within a token budget without LLM calls.

Instructions

Compress natural-language text to save tokens while preserving technical substance (code, URLs, file paths). Strategies: truncate, caveman, graphify, ponytail. 'caveman' applies the MIT-licensed caveman-compress rule-based tersification; 'truncate' hard-cuts at the token budget; 'graphify'/'ponytail' are native token-light heuristics. No LLM call.

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": {
      "text": "<text>"
    },
    "name": "memento_compact"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesThe text to compact.
strategyNoCompaction strategy (default: caveman).caveman
max_tokensNoApproximate token budget for the output (default: 60).
workspace_rootNoMANDATORY: The absolute path of the current project/workspace root.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.2.2

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description does real work: it declares 'No LLM call' (deterministic, zero model cost), labels caveman as a rule-based MIT-licensed pass and graphify/ponytail as native heuristics, and asserts that technical substance is preserved. It does not say what the return value looks like or whether truncate can sever a token mid-structure, which is the remaining gap for a transformation tool.

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?

Front-loaded with the purpose, then strategy definitions in a single dense closing sequence; nothing is padded. The 'MIT-licensed' detail is borderline trivia but justifiable since it signals provenance of the compression rules.

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 4-parameter text transformation with no output schema and no annotations, the description covers what the tool does, how each strategy behaves, and that output is heuristic rather than model-generated. The one omission an agent would want is the shape of the result (compacted text only, or text plus token counts), which matters when choosing a token budget.

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%, so the baseline is 3; the description exceeds it only partially by characterizing the enum values (truncate = hard cut at budget, caveman = MIT rule-based tersification, graphify/ponytail = native heuristics). It adds nothing about max_tokens behavior beyond the schema's 'approximate' note and never mentions workspace_root, which the schema itself flags as MANDATORY.

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 concrete verb and resource ('Compress natural-language text') plus the goal (save tokens) and the invariant it protects (code, URLs, file paths). The name is unusual, but the description makes the operation unambiguous, and no sibling (memento_code, memento_kg, memento_search, etc.) overlaps with text compaction.

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?

It explains what each strategy does, which implicitly guides strategy choice, but never states when to reach for this tool versus other memento tools or when compaction is inappropriate (e.g. lossless-critical text). Usage is implied by the framing, not spelled out.

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