Skip to main content
Glama

Compress file

compress_file
Read-only

Compress a local text file by reading it and returning a token-reduced version with token stats, without changing the original file.

Instructions

Read a local text file (prompt, docs, logs, JSON, code) and return a compressed version with token stats. Does not modify the file.

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": {
      "path": "<path>"
    },
    "name": "compress_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path to a local text file.
levelNoRisk level. 'none' = whitespace/unicode only; 'very-low' = + filler, phrases, JSON/SQL minify; 'low' = + hedging, comments, dedup (recommended); 'medium' = + extractive summarization (may drop sentences).low

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

The statement 'Does not modify the file' largely restates the readOnlyHint=true annotation, though it does add useful confirmation of the safety contract for a file-path tool. The description adds that the return includes token stats, which is not in the annotations and is genuinely helpful, but says nothing about file size limits, encoding expectations, or error behavior for missing paths.

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?

Two short sentences, front-loaded with the core action and closed with the safety guarantee. Every clause earns its place and there is no filler.

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 two-parameter read-only tool with no output schema, the description covers action, input domain, return shape (compressed text plus token stats) and non-mutation. Remaining gaps are edge-case behaviors such as handling of non-text or oversized files, which are minor given the rich schema.

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 description coverage is 100%, and the schema itself fully explains the level enum including the caveat that 'medium' may drop sentences. The description never mentions the level parameter or its risk trade-off, so it adds no meaning beyond what the schema already supplies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb pair (read + compress) and a specific resource (a local text file), and enumerates the accepted content types (prompt, docs, logs, JSON, code). It does not explicitly distinguish itself from sibling compress_prompt or estimate_tokens, so an agent must infer that file-path input is the differentiator.

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?

Usage is implied by the phrase 'Read a local text file', which suggests this is the file-based variant versus in-memory siblings, but no alternative is named and no when-not guidance is given. An agent has enough to guess, but nothing explicit routes it between compress_file, compress_prompt and compare_levels.

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