Skip to main content
Glama

IA-QA — 152 QA & Dev Tools for AI Agents

optimize_prompt_tokens

Read-onlyIdempotent

Compress an LLM prompt by removing filler words, verbose phrases, duplicate sentences, and unnecessary whitespace. Returns optimized text with token savings breakdown. 100% deterministic, no API key needed.

Input Schema

NameRequiredDescriptionDefault
textYesThe prompt text to optimize
optionsNoToggle optimization steps (all true by default)

Output Schema

NameRequiredDescriptionDefault
stepsNo
optimizedNo
tokens_afterNo
tokens_savedNo
percent_savedNo
tokens_beforeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "text": "Please   kindly    make sure that you   basically   summarize   the following text."
      +  }
      +]
  2. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "optimized": {},
      +  "percent_saved": {
      +    "type": "string"
      +  },
      +  "steps": {},
      +  "tokens_after": {},
      +  "tokens_before": {},
      +  "tokens_saved": {}
      +}
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  4. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is covered. The description adds genuinely non-obvious behavioral facts beyond that: the operation is fully deterministic, requires no API key or model call, and returns a token-savings breakdown alongside the optimized text.

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 tight sentences: what it does, what it returns, and the operational constraint. Nothing is padded, and the capability statement is front-loaded before the return-value and determinism details.

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?

The output schema is present, so the description need not explain the return shape, and it still summarizes it in one phrase. Combined with full schema coverage and rich annotations, the only real gap is the unexplained "instructions" toggle and the lack of sibling routing.

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%, so the baseline is 3, and the description's list of removal categories roughly maps onto the fillers/duplicates/whitespace toggles. However, the fourth toggle ("instructions") has no corresponding explanation anywhere, and the description doesn't clarify that optimization steps can be selectively disabled via the options object.

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 an LLM prompt") and enumerates exactly what is removed: filler words, verbose phrases, duplicate sentences, whitespace. It does not name any sibling to contrast with, but the phrase "100% deterministic, no API key needed" implicitly distinguishes it from the LLM-backed tools in the same family.

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 only implied: the description makes clear this is for shortening a prompt before sending it to a model, but it gives no explicit when-to-use or when-not-to-use guidance. Siblings such as normalize_whitespace, strip_markdown, truncate_to_tokens, and count_tokens overlap in territory and the description never routes the agent between them.

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.