Skip to main content
Glama

Etuki FinOps & LLM Pricing Oracle

compress_and_fold_context

Read-onlyIdempotent

Compresses verbose terminal or build logs by folding repetitive middle progress lines while preserving 100% of head lines, tail lines, compiler errors, stack traces, and file paths. Deterministic in-memory string transformation that mutates no files and requires no authentication. Returns JSON containing line_accounting_reconciliation (where raw_total_lines equals kept_original_lines_total plus omitted_repetitive_lines), byte_and_token_reconciliation (pricing saved tokens against model's input rate), and folded_context_payload. When raw_text is empty or under 50 lines, returns the diagnostic benchmark or unmodified input without truncation. Use this tool when build or test output exceeds 50 lines before appending to agent context; use pin_single_model_prefix_cache instead when optimizing static system prompt prefixes.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compress_and_fold_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoCanonical model ID ('vendor/model-slug') used to price eliminated input tokens in USD.openai/gpt-6.1-sol
raw_textNoRaw terminal, test, or build log text to compress losslessly.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / model / description
      Previous value: -"Model ID used to calculate USD savings from eliminated tokens."New value: +"Canonical model ID ('vendor/model-slug') used to price eliminated input tokens in USD."
  2. Changed3 schema fields changed
    • changedInput schema / properties / model / description
      Previous value: -"Model ID for token pricing"New value: +"Model ID used to calculate USD savings from eliminated tokens."
    • addedInput schema / properties / raw_text / default
      Added value: +""
    • changedInput schema / properties / raw_text / description
      Previous value: -"Raw terminal or build log text to fold"New value: +"Raw terminal, test, or build log text to compress losslessly."
  3. Changed2 schema fields changed
    • addedInput schema / properties / model / description
      Added value: +"Model ID for token pricing"
    • addedInput schema / properties / raw_text / description
      Added value: +"Raw terminal or build log text to fold"
  4. Added
  5. Removed
  6. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, closed-world and non-destructive, so the bar is lower; the description still adds real context: deterministic in-memory transformation, no file mutation, no auth, and 100% preservation of head/tail lines, compiler errors, stack traces and file paths. It also documents the short-input fallback (empty or under 50 lines returns the benchmark or unmodified input). It stops short of stating ordering/format details of the payload, so not a 5.

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 core behavior and preservation guarantee, followed by safety, return shape, edge case and routing. The return-value parenthetical ('where raw_total_lines equals kept_original_lines_total plus omitted_repetitive_lines') is denser than needed, but every sentence carries information.

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?

No output schema exists, and the description compensates by naming the three returned fields and their reconciliation invariants, plus the degenerate short-input behavior. For a 2-parameter, zero-required, deterministic transform, nothing an agent needs to invoke or interpret it correctly is missing.

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%, so baseline is 3; the description adds meaning beyond the schema by tying 'model' to pricing eliminated tokens against the model's input rate and by defining the raw_text edge case at 0 or fewer than 50 lines. Marginal but genuine added semantics.

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 specific verb and resource ('Compresses verbose terminal or build logs by folding repetitive middle progress lines') plus the exact preservation guarantee. It also names the sibling it is not (pin_single_model_prefix_cache), so an agent can separate the two 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?

Gives an explicit trigger condition ('when build or test output exceeds 50 lines before appending to agent context') and an explicit alternative with the condition that selects it ('use pin_single_model_prefix_cache instead when optimizing static system prompt prefixes'). This is the when/when-not/alternative pattern at full strength.

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.