Skip to main content
Glama

compress

Idempotent

Compress prose before it enters an LLM context window. Returns the compressed text plus a signed receipt (ratios, refusals, coverage) so the caller can verify what was dropped. Use this instead of truncating or slicing text to fit a budget: truncation drops the tail silently, compression keeps a sentence skeleton and reports what went. Do not use it for source code, config, JSON, diffs or tables - send those verbatim. Very short input (under roughly 2,000 chars) gains little, and verified mode is slower there. To compress a web page, fetch it with the read tool first and compress the markdown it returns, never raw HTML. Prefer deterministic for bulk low-stakes text (free), extractive for ordinary prose, verified when a silently dropped fact would be expensive. Flat per-call price by mode: deterministic free, extractive $0.0008, verified $0.0015 (USDC on Base L2); insufficient credit returns HTTP 402.

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": "compress"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesProse to compress: articles, docs, transcripts, chat or tool output, long extracted text. Poor fit, send verbatim instead: source code, config, JSON, diffs, tables - forcing them loses or mangles content. Caps are per mode: deterministic 200,000 chars, extractive 40,000 chars (12,500 tokens), verified 20,000 chars (7,000 tokens); over the cap the call returns HTTP 413.
squeeze_modeNodeterministic = rule-based pruning, no model, free, and it ignores target_ratio. extractive = LLMLingua-class sentence dropping (output is a token skeleton: the reader reconstructs the glue), served from one model session, honours target_ratio. verified = extractive plus a coverage pass; stages can spread over spare model sessions, so with spare capacity it can be faster than extractive on the same input, while with none (pool busy) or on input too short to split (roughly under 2,000 characters) it is slower. Any other value returns HTTP 501.extractive
target_ratioNoFraction of the ORIGINAL characters to keep, exclusive: 0 or 1 is rejected with HTTP 422. Applied as a pruning cap in extractive and verified - the engine stops pruning once the realized ratio would drop below it - and the receipt's headline.ratio reports what was actually kept, which can be higher. On verified the fidelity gate can keep more than the same hint would in extractive: a failed attempt is retried with less compression and the receipt then shows quality.relax_steps with the pre-retry ratio in quality.relaxed_ratio. Ignored by deterministic, and unreachable on tabular JSON payloads (the receipt then shows l2_skipped=json_reform). Omit to use the calibrated default.
_idempotency_keyNoRetry safety for the charge. The same key is billed once: a retry after a transport error is not charged again, and the call still runs, so the response is fresh rather than a replayed one. Omit it and a fresh UUID is generated per call, so every call charges. Use one key per distinct payload.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / target_ratio / description
      Previous value: -"Fraction of the ORIGINAL characters to keep, exclusive: 0 or 1 is rejected with HTTP 422. Applied as a pruning cap in extractive and verified - the engine stops pruning once the realized ratio would drop below it - and the receipt's headline.ratio reports what was actually kept, which can be higher. Ignored by deterministic, and unreachable on tabular JSON payloads (the receipt then shows l2_skipped=json_reform). Omit to use the calibrated default."New value: +"Fraction of the ORIGINAL characters to keep, exclusive: 0 or 1 is rejected with HTTP 422. Applied as a pruning cap in extractive and verified - the engine stops pruning once the realized ratio would drop below it - and the receipt's headline.ratio reports what was actually kept, which can be higher. On verified the fidelity gate can keep more than the same hint would in extractive: a failed attempt is retried with less compression and the receipt then shows quality.relax_steps with the pre-retry ratio in quality.relaxed_ratio. Ignored by deterministic, and unreachable on tabular JSON payloads (the receipt then shows l2_skipped=json_reform). Omit to use the calibrated default."
  2. Changed8 schema fields changed
    • changedInput schema / properties / _idempotency_key / description
      Previous value: -"Optional retry-safe idempotency key. The same key twice is processed once (no double charge). Omit to have a unique key generated per call."New value: +"Retry safety for the charge. The same key is billed once: a retry after a transport error is not charged again, and the call still runs, so the response is fresh rather than a replayed one. Omit it and a fresh UUID is generated per call, so every call charges. Use one key per distinct payload."
    • changedInput schema / properties / squeeze_mode / description
      Previous value: -"deterministic = rule-based pruning, no model. extractive = LLMLingua-class sentence dropping (output is a token skeleton: the reader reconstructs the glue); served from one model session. verified = extractive plus a coverage pass; its stages can spread over spare model sessions, so with spare capacity it can be faster than extractive on the same input, while with none (pool busy) or on input too short to split (roughly under 2,000 characters) it is slower."New value: +"deterministic = rule-based pruning, no model, free, and it ignores target_ratio. extractive = LLMLingua-class sentence dropping (output is a token skeleton: the reader reconstructs the glue), served from one model session, honours target_ratio. verified = extractive plus a coverage pass; stages can spread over spare model sessions, so with spare capacity it can be faster than extractive on the same input, while with none (pool busy) or on input too short to split (roughly under 2,000 characters) it is slower. Any other value returns HTTP 501."
    • changedInput schema / properties / target_ratio / description
      Previous value: -"Fraction of the input to keep. A hint, not a guarantee - the signed receipt reports what was actually kept."New value: +"Fraction of the ORIGINAL characters to keep, exclusive: 0 or 1 is rejected with HTTP 422. Applied as a pruning cap in extractive and verified - the engine stops pruning once the realized ratio would drop below it - and the receipt's headline.ratio reports what was actually kept, which can be higher. Ignored by deterministic, and unreachable on tabular JSON payloads (the receipt then shows l2_skipped=json_reform). Omit to use the calibrated default."
    • addedInput schema / properties / target_ratio / exclusiveMaximum
      Added value: +1
    • addedInput schema / properties / target_ratio / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / target_ratio / maximum
      Removed value: -1
    • removedInput schema / properties / target_ratio / minimum
      Removed value: -0.1
    • changedInput schema / properties / text / description
      Previous value: -"Text to compress. Prose is the good fit; source code, config and diffs are a poor fit (little redundancy, forcing them can break meaning) - send those verbatim."New value: +"Prose to compress: articles, docs, transcripts, chat or tool output, long extracted text. Poor fit, send verbatim instead: source code, config, JSON, diffs, tables - forcing them loses or mangles content. Caps are per mode: deterministic 200,000 chars, extractive 40,000 chars (12,500 tokens), verified 20,000 chars (7,000 tokens); over the cap the call returns HTTP 413."
  3. Changed1 schema field changed
    • changedInput schema / properties / squeeze_mode / description
      Previous value: -"deterministic = rule-based pruning, no model. extractive = LLMLingua-class sentence dropping (output is a token skeleton: the reader reconstructs the glue). verified = extractive plus a coverage pass, slower."New value: +"deterministic = rule-based pruning, no model. extractive = LLMLingua-class sentence dropping (output is a token skeleton: the reader reconstructs the glue); served from one model session. verified = extractive plus a coverage pass; its stages can spread over spare model sessions, so with spare capacity it can be faster than extractive on the same input, while with none (pool busy) or on input too short to split (roughly under 2,000 characters) it is slower."
  4. Changed1 schema field changed
    • addedInput schema / properties / _idempotency_key
      Added value: +{
      +  "description": "Optional retry-safe idempotency key. The same key twice is processed once (no double charge). Omit to have a unique key generated per call.",
      +  "type": "string"
      +}
  5. Added

TDQS

A4.9/5.0
Behavior5/5

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

The annotations already establish that this is a non-destructive, idempotent, non-open-world operation, but the description adds substantial behavioral context: signed receipt contents, per-mode pricing, HTTP 402/413/422/501 failure modes, per-mode caps, short-input limitations, and verified-mode retry behavior. That is materially beyond what the annotations provide.

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?

The description front-loads the core action and return value, then proceeds through exclusions, special cases, mode selection, and pricing. Despite its length, every sentence carries operational guidance, and there is little wasted text.

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?

For a complex, paid, mode-dependent tool with no output schema, the description explains the return shape, error behavior, billing, caps, suitability constraints, and mode tradeoffs. Combined with full parameter descriptions and annotations, an agent has what it needs to invoke the tool correctly.

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 parameters are already well documented. The description still adds meaningful selection guidance by recommending deterministic, extractive, or verified modes for different workloads, and it flags the short-input threshold where verified mode is slower. The remaining parameter detail is mostly repeated from 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?

The description states a specific verb and resource: compress prose before it enters an LLM context window. It also names the return payload (compressed text plus signed receipt) and distinguishes the operation from truncation/slicing, so the agent can identify the tool without opening the 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 gives explicit when-to-use, when-not-to-use (source code, config, JSON, diffs, tables), and alternative handling for web pages via the read tool. It also routes between modes with clear conditions: deterministic for bulk low-stakes text, extractive for ordinary prose, verified when a dropped fact would be costly.

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.

Resources