Skip to main content
Glama

slimtoken.optimize_messages

Minify prompts and compress tool results to reduce token usage while keeping message structure and tool-call validity intact. Returns minified messages and token counts.

Instructions

Reduce prompt size while preserving message structure and tool-call validity (pair-safe, fence-aware). Returns the minified messages plus token counts. Lossy by default (distill + tool-result compression); disable stages via the SLIMTOKEN_MINIFY_* env knobs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolsNotool definitions to minify
formatNorequest format (anthropic=identity; openai/ollama are normalized to canonical, minified, then returned)anthropic
systemNosystem prompt (string or list of text blocks)
messagesYesAnthropic-style messages array
max_input_tokensNooverride the token_budget (hard prune cap)
Behavior4/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It explicitly states 'Lossy by default (distill + tool-result compression)' and mentions how to disable stages via SLIMTOKEN_MINIFY_* env knobs, which is meaningful for a mutation-like tool. It could go further by explaining 'distill' or authentication needs, but the disclosure is strong.

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?

The description is two concise sentences, front-loaded with the core purpose in the first sentence and key behavioral caveats in the second. Every word earns its place, with no filler or redundancy.

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 description mentions the return value (minified messages plus token counts) and the lossy default with env-knob control, which is sufficient for a tool with a well-documented schema. However, it does not elaborate on what 'pair-safe, fence-aware' entails or how it differs from sibling tools, leaving minor gaps for deeper contextual understanding.

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 each parameter already has a descriptive schema entry, including format behavior and default. The description adds no additional parameter-level detail beyond what the schema provides, so the baseline of 3 applies.

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

Purpose5/5

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

The description uses a specific verb+resource: 'Reduce prompt size while preserving message structure and tool-call validity (pair-safe, fence-aware).' This clearly states the operation and its distinctive scope, distinguishing it from sibling tools like prune_context by emphasizing lossy compression and structural preservation.

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 clearly implies when to use the tool (for reducing prompt size while preserving structure) and gives config context via env knobs. However, it does not explicitly mention when not to use it or name alternatives among siblings, so it stops short of a 5.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/greyok00/slimtoken'

If you have feedback or need assistance with the MCP directory API, please join our Discord server