Skip to main content
Glama

ai_token_trim

Read-onlyIdempotent

AI Token Trimmer: shorten text before sending it to an AI model (rules only, no AI cost). Returns the trimmed text and an estimated token saving.

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

Input Schema

NameRequiredDescriptionDefault
textYesThe text to process, plain UTF-8, for example: The quick brown fox.
queryNoQuery as text.
dedupeNotrue or false: dedupe. Default false.
maxTokensNoMax tokens (50 to 200000) as a plain number, for example 50.
stripFootersNotrue or false: strip footers. Default false.

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 already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, and openWorldHint=false. The description adds meaningful context beyond those annotations by stating the operation is rules-only with no AI cost and by naming the return values: trimmed text and an estimated token saving.

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?

The description is compact and front-loads the purpose before mentioning the return values. The opening label 'AI Token Trimmer' is slightly redundant with the tool name, but the content is otherwise efficient.

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?

Given the rich annotations, 100% schema description coverage, and absence of an output schema, the description is nearly complete. It states the return values, but it could say more about what trimming entails or how the token saving is estimated.

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%, so the input schema already documents all five parameters in detail. The description does not add any parameter-specific meaning beyond that, which is acceptable but warrants the baseline score.

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 states a specific verb and resource: shorten text before sending to an AI model, and it clarifies the method is rules-only with no AI cost. It is clear what the tool does, but it does not explicitly distinguish itself from a sibling such as ai_prompt_optimize.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear usage context: use it to shorten text before sending it to an AI model. It does not state when not to use it or name explicit alternatives, so it stops short of the highest level of guidance.

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