Skip to main content
Glama

tksq_compress

Compress text to reduce LLM token usage while preserving meaning, code blocks, and URLs, then return token-reduction statistics.

Instructions

Compress text to reduce LLM token usage while preserving meaning. Removes filler phrases, applies concise substitutions, and normalizes whitespace. Automatically preserves code blocks, inline code, and URLs. Returns compressed text with token reduction statistics.

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

Input Schema

NameRequiredDescriptionDefault
textYesThe text to compress
levelNoCompression level. light=cleanup only, medium=cleanup+semantic (default), aggressive=all 4 stages
domainNoDictionary domain. general=prose (default), programming=code, legal=contracts, academic=papers
languageNoLanguage for compression dictionaries. auto=detect from text (default), en=English, ru=Russian
tokenizerNoTokenizer for counting. cl100k_base=GPT-4/Claude (default), o200k_base=GPT-4o, approximate=fast estimate
preserve_patternsNoAdditional regex patterns for text regions to preserve (code blocks, URLs already preserved by default)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

A3.8/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 names the three operations performed (filler removal, concise substitutions, whitespace normalization) and guarantees that code blocks, inline code, and URLs are preserved. It also states the return shape (compressed text plus token reduction statistics). It stops short of stating that the input is untouched, whether compression is lossy, or any failure modes.

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?

Three front-loaded sentences with no filler: purpose first, mechanism second, preservation guarantees and return value last. Every sentence contributes information an agent would otherwise have to guess.

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?

Six parameters and no output schema, so the description must cover both the transformation and the return value; it does both, noting token reduction statistics come back with the text. Gaps are minor but real: no note on input immutability, token-cost of aggressive compression, or behavior on already-compressed or non-target-language input.

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 all four enums are self-documented, so the schema already carries the parameter burden. The description only adds indirect meaning, confirming that code blocks and URLs are preserved by default, which contextualizes preserve_patterns, but it never explains level, domain, language, or tokenizer.

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?

States a specific verb and resource ('Compress text') plus the goal ('reduce LLM token usage while preserving meaning'). An agent can tell this apart from counting or packing siblings by the verb alone, though the description never names an alternative to disambiguate further.

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 stated goal (compress when token budget matters), but there is no explicit when-to-use/when-not guidance, no mention of when tksq_count or tksq_pack would be the better call, and no preconditions for choosing a compression level.

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