Skip to main content
Glama

ai_prompt_compress

Read-only

AI prompt compressor — Shrink an LLM prompt to cut token cost while keeping every instruction, constraint, placeholder and number. Returns the compressed prompt, token counts before/after and % saved, a SAFE/REVIEW verdict that flags any number, {placeholder} or keep= term lost by the rewrite, and a lossless offline cleanup version as a fallback. prompt= required; optional target= (0.2-0.9 length ratio, default 0.5) and keep= (comma-separated terms that must stay). Price: $0.006 USDC (Base, via x402).

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": {
      "prompt": "<prompt>"
    },
    "name": "ai_prompt_compress"
  }
}

Input Schema

NameRequiredDescriptionDefault
promptYese.g. I would like you to please summarize the following {doc} in order to help me. Make sure to use exactly 3 bullet points and keep it under 50 words.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations only cover safety/scope (readOnly, non-destructive, open-world), so the description carries the real burden and does so well: it discloses the return payload, the SAFE/REVIEW loss-detection verdict, the offline lossless fallback, and the paid x402/USDC cost model with price. It stops short of stating rate limits, latency, or what happens when the rewrite cannot preserve a placeholder.

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 purpose, then outputs, then parameters, then price — a logical order with no filler sentences. It is dense and slightly overpacked into one paragraph, and the pricing clause sits in the middle of behavior rather than at the end.

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?

With no output schema, the description must explain return values, and it fully does (compressed prompt, before/after token counts, % saved, verdict, fallback). Together with parameter semantics and cost, an agent has everything needed to invoke this correctly and decide whether to call it.

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?

The single schema parameter is fully documented, so baseline would be 3; the description earns more by explaining target (0.2–0.9 ratio, default 0.5) and keep (comma-separated must-keep terms). Note that target and keep are described but absent from the input schema properties, so the semantic additions are the only documentation an agent gets for them.

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?

Specific verb and resource: 'Shrink an LLM prompt to cut token cost', qualified with the preservation guarantee ('keeping every instruction, constraint, placeholder and number'). That distinguishes it from a generic rewrite/improve tool, but no sibling (e.g. ai_prompt_improve) is named, so the boundary with the closest alternative is left implicit.

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?

The motivation (cut token cost) implies when to reach for it, and the SAFE/REVIEW verdict plus lossless fallback implies a verification workflow. However, there is no explicit when-to-use/when-not guidance and no routing to ai_prompt_improve for cases where the prompt needs rewriting rather than shrinking.

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