Skip to main content
Glama
DCx7C5

token-optimization-mcp

by DCx7C5

token-optimization-mcp v0.2.0

Production-ready Model Context Protocol server for token counting, prompt compression, model routing and semantic caching. Zero external API calls — works fully offline.

Tools

Tool

Description

estimate_tokens

Count tokens for any text+model (calibrated chars/token ratios)

compress_prompt

Shrink prompts with trim, summarize_hint or aggressive strategy

route_model

Pick cheapest model meeting quality + context requirements

cache_lookup

Semantic cache hit/miss by prompt or pre-computed key

cache_store

Store prompt+result with token-savings metadata

cache_invalidate

Remove one or all cache entries

analyze_context

Conversation health: role breakdown, issues, recommendations

savings_report

Session-level token/USD savings dashboard

deduplicate_messages

Remove duplicate turns, count saved tokens

Related MCP server: TokenSaver MCP

Quick Start

cd mcps/token-optimization-mcp
uv sync

# stdio – Claude Code / Copilot
uv run main.py

# SSE – LangGraph / CrewAI / browser
uv run main.py --sse --port 8001

Environment Variables

Variable

Default

Description

USE_REDIS

false

Enable Redis backend

REDIS_URL

redis://localhost:6379/1

Redis connection URL

CACHE_TTL_SECONDS

86400

Default cache TTL (1 day)

RATE_LIMIT_PER_MIN

120

Requests/min per client

AUDIT_LOG_ENABLED

true

Print audit log to stdout

Registration

Claude Code (~/.claude/settings.json)

{
  "mcpServers": {
    "token-optimization": {
      "command": "uv",
      "args": ["run", "/path/to/token-optimization-mcp/main.py"]
    }
  }
}

VS Code Copilot (.vscode/mcp.json)

{
  "servers": {
    "token-optimization": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "${workspaceFolder}/mcps/token-optimization-mcp/main.py"]
    }
  }
}

SSE (LangGraph / CrewAI / Cursor)

http://127.0.0.1:8001/sse

Supported Models (routing catalogue)

Model

Context

Quality

Cost/1k

github:copilot

128k

8

free

gpt-4o-mini

128k

7

$0.00015

claude-3-5-haiku

200k

7

$0.00025

gemini-1.5-flash

1M

6

$0.000075

gpt-4o

128k

9

$0.005

claude-3-5-sonnet

200k

9

$0.003

claude-3-opus

200k

10

$0.015

Testing

uv run --group test pytest
# 118 tests, 100% coverage

Architecture

token-optimization-mcp/
├── main.py                      ← FastMCP server (9 tools)
├── pyproject.toml
├── README.md
├── tests/
│   ├── conftest.py              ← state-reset fixtures
│   ├── test_helpers.py          ← unit tests + Hypothesis
│   └── test_tools.py            ← integration tests per tool
└── mcp-servers/
    └── context-cache-server/    ← standalone Redis-backed sub-server
        ├── server.py
        ├── config.py
        └── security.py

Available Tools

9 tools
analyze_contextA

Analyze a list of chat messages ({role, content}) for token usage and issues. Detects bloated system prompts, near-full context windows, and repeated content. Returns per-role breakdown, issues list, and recommendations.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNogpt-4o
messagesYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior3/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 discloses the analysis outputs (per-role breakdown, issues, recommendations), which adds transparency, but it does not explicitly state whether the tool is read-only or has any side effects. Given typical analysis tools, a score of 3 is adequate but not excellent.

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 concise at three sentences, with the most critical information front-loaded. Every sentence adds value: the first states the action, the second lists specific detections, and the third describes the output. No unnecessary fluff.

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 tool's moderate complexity and the presence of an output schema, the description covers the main functionality well. It does not mention potential limitations like maximum message count or rate limits, but overall it provides sufficient context for an agent to understand when and how to use the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must compensate. It mentions messages have role and content, which adds some meaning, but it does not describe the 'model' parameter or clarify the structure of messages beyond 'chat messages'. This leaves the agent unclear about parameter formats.

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 clearly states the tool's purpose: analyzing chat messages for token usage and issues such as bloated system prompts, near-full context windows, and repeated content. It distinguishes itself from sibling tools like estimate_tokens (simple token counting) and compress_prompt (compression) by offering a comprehensive analysis with specific detections.

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

Usage Guidelines2/5

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

The description does not provide guidance on when to use this tool versus alternatives like estimate_tokens or compress_prompt. Without explicit when-to-use or when-not-to-use instructions, an AI agent may struggle to select the most appropriate tool from the sibling set.

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

cache_invalidateA

Invalidate one or all cache entries. Pass cache_key to remove one entry, or flush_all=true to wipe everything.

ParametersJSON Schema
NameRequiredDescriptionDefault
cache_keyNo
flush_allNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.1/5.0
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states 'invalidate', which suggests a destructive action, but does not elaborate on whether it is irreversible, the effects on other cache operations, or any authorization requirements. Additional detail is needed.

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 extremely concise, consisting of two sentences. The first sentence states the overall purpose, and the second explains the parameter usage. No extraneous information is included.

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 is largely complete for a simple tool with an output schema. It covers the key usage scenario and parameter semantics. However, it could explicitly state that cache_key and flush_all are mutually exclusive, though this is implied. The presence of an output schema reduces the need to describe return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With schema description coverage at 0%, the description fully compensates by explaining the meaning and usage of both parameters: cache_key for a single entry and flush_all to clear everything. This adds critical context beyond the bare JSON schema types.

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 clearly states the tool's purpose: 'Invalidate one or all cache entries.' It specifies the verb 'Invalidate' and the resource 'cache entries', and distinguishes between single entry invalidation and flushing all entries.

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 provides clear guidance on when to use each parameter: 'Pass cache_key to remove one entry, or flush_all=true to wipe everything.' It implies the appropriate context for each option but does not explicitly state when not to use the tool or compare it to siblings, though the sibling list includes cache_lookup and cache_store.

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

cache_lookupA

Look up a cached result by prompt text or pre-computed cache key. Returns {hit: true, result, tokens_saved} or {hit: false}.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptNo
cache_keyNo
client_idNodefault

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden. It discloses the read-only nature implicitly (lookup returns data or miss) and explains the output format. However, it could explicitly state that no data is modified.

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?

Two sentences with no filler. The verb 'Look up' is front-loaded. Every word serves a purpose.

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 no annotations and presence of an output schema, the description is mostly complete. It could mention that at least one of prompt or cache_key should be provided, but the general behavior is well-covered.

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 0%, so the description must compensate. It explains the two main parameters (prompt and cache_key) and client_id, but does not clarify precedence or exclusivity when both are provided. This ambiguity reduces clarity.

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 clearly states the tool's purpose: 'Look up a cached result by prompt text or pre-computed cache key.' It specifies the return structure and distinguishes it from sibling tools like cache_store and cache_invalidate.

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 implies usage for checking cache hits, but does not explicitly state when to use it vs alternatives (e.g., cache_store for misses). The context is clear enough for an AI agent.

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

cache_storeA

Store a prompt+result in the cache. Provide prompt (auto-hashed), result text, tokens_saved estimate, optional TTL override and metadata dict.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYes
resultYes
metadataNo
client_idNodefault
ttl_secondsNo
tokens_savedYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior3/5

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

The description discloses that the prompt is auto-hashed, which is a behavioral trait beyond the schema. However, it fails to mention behavior on duplicates, overwrites, size limits, or rate limits, and there are no annotations to fill the gap.

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 a single sentence that efficiently conveys the core purpose and key parameters. It is concise and front-loaded, though slightly more structure could improve readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, the description does not need to explain return values, but it omits any mention of what the tool returns. It covers input semantics adequately but leaves some behavioral and output context incomplete.

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?

With 0% schema description coverage, the description adds meaning for most parameters: prompt (auto-hashed), result, tokens_saved, ttl_seconds, and metadata. It does not mention client_id, but covers 5 of 6 parameters with useful context.

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 clearly states 'Store a prompt+result in the cache', using a specific verb and resource. It distinguishes from siblings like 'cache_invalidate' and 'cache_lookup' which perform different operations.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description does not include when-to-use, when-not-to-use, or any exclusions.

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

compress_promptB

Compress a prompt to reduce token usage. strategy: 'trim' (whitespace/blanks), 'summarize_hint' (mark long sections), 'aggressive' (strip comments, examples, filler). Returns compressed text + savings stats.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNogpt-4o
promptYes
strategyNotrim
target_tokensNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.3/5.0
Behavior3/5

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

Without annotations, the description carries the full burden. It discloses that the tool returns compressed text and savings stats and outlines three strategies. However, it does not clarify side effects, reversibility, or behavior of parameters like model and target_tokens.

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 two sentences, front-loaded with the primary purpose. It is concise, but a more structured format could improve readability for multiple strategies and parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no schema descriptions, no annotations, and sibling tools, the description covers strategies but lacks details for model and target_tokens. Output schema exists but is not provided; the description mentions return values sufficiently, but parameter explanations are incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains the strategy parameter's values but fails to describe model (likely for summarization), prompt (the input), and target_tokens (target token count). This leaves key parameters underspecified.

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 states 'Compress a prompt to reduce token usage' and lists specific strategies (trim, summarize_hint, aggressive), making the purpose clear and distinct from sibling tools like estimate_tokens or cache_lookup.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as estimate_tokens or deduplicate_messages. The description implies token reduction but does not specify prerequisites or conditions for choosing compression over other operations.

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

deduplicate_messagesB

Remove duplicate messages from a conversation (keeps last occurrence). Returns deduplicated list + tokens saved.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNogpt-4o
messagesYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries full burden. It discloses key behavior (keeps last occurrence, returns deduplicated list + tokens saved) but does not clarify whether the original messages array is modified or if there are any side effects or permission requirements.

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 extremely concise (two sentences) and front-loaded with the core action. No irrelevant details or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with two parameters and an output schema, the description covers the basic purpose and return format, but omits parameter descriptions and usage context. It is adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must explain parameters. It only vaguely references 'messages from a conversation' but does not detail the 'model' parameter or the expected format of the messages array, leaving the agent with insufficient guidance.

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 explicitly states the tool removes duplicate messages from a conversation and specifies the deduplication strategy ('keeps last occurrence'), which clearly distinguishes it from sibling tools like compress_prompt or cache_lookup.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. For example, there is no mention of typical scenarios or comparisons to compress_prompt or savings_report.

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

estimate_tokensA

Estimate token count for a text string. Uses calibrated chars/token ratios per model. Example: estimate_tokens(text='Hello world', model='gpt-4o') → {tokens: 2, ...}

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
modelNogpt-4o

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states it uses 'calibrated chars/token ratios per model' but does not disclose error handling (e.g., unsupported models), limitations (e.g., max text length), or side effects (none expected). Minimal behavioral context.

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?

Two concise sentences plus an example. Every part is valuable: verb, resource, technique, example. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema (not shown but mentioned), the description does not need to detail return values. It covers the core functionality but misses context about model compatibility, potential errors, and differentiation from siblings. For a tool of this simplicity, a 3 is adequate.

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 0% (no descriptions in input schema). The description adds that the model parameter influences the number of tokens via 'calibrated chars/token ratios' and provides an example showing default model and output shape. However, it does not explain the text parameter's format or constraints, and the model parameter's supported values are not listed. Adequate but not comprehensive.

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 clearly states the verb ('Estimate token count') and resource ('text string'), with an example that demonstrates usage. It distinguishes itself from sibling tools like compress_prompt and analyze_context by focusing solely on token estimation.

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 description implies usage via the example but does not explicitly state when to use this tool versus alternatives. It lacks guidance on scenarios like when to use estimate_tokens vs compress_prompt or route_model.

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

route_modelA

Recommend the cheapest capable model for a task. Filter by min_quality (1-10, default 7) and max_cost_per_1k USD. Returns ranked candidates with per-call cost estimate.

ParametersJSON Schema
NameRequiredDescriptionDefault
min_qualityNo
prefer_freeNo
max_cost_per_1kNo
estimated_tokensYes
require_long_contextNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior2/5

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

No annotations provided, so description carries full burden. It mentions filtering criteria and returns, but does not disclose failure behavior (e.g., if no model meets constraints), side effects, auth needs, or how capability is determined. Significant gaps for a recommendation tool.

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?

Two sentences, front-loaded with purpose. No wasted words. Efficient and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 5 parameters and an output schema, description covers the core idea but misses details on some parameters and behavioral aspects like empty results. Adequate but not comprehensive.

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 has 5 parameters with 0% description coverage. Description explains min_quality (1-10, default 7) and max_cost_per_1k, but omits prefer_free and require_long_context. Estimated_tokens is required but only implied. Adds meaning but incomplete.

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?

Description states 'Recommend the cheapest capable model for a task.' This is a specific verb+resource pair. Among siblings (analyze_context, cache, etc.), none offer model recommendation, so it is clearly distinguished.

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?

Description implies usage when selecting a cost-effective model, but does not explicitly state when to use this tool versus alternatives, nor when not to use it. Missing guidance on when to use siblings like analyze_context or savings_report.

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

savings_reportB

Token savings dashboard for the current session. Shows cache hits, tokens saved, and estimated USD savings per client.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNogpt-4o

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

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

No annotations provided, so description carries full burden. It states 'for the current session' implying read-only behavior, but does not explicitly confirm non-destructive nature or any side effects.

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?

Two clear sentences with no unnecessary words. Front-loaded with the primary purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers key output contents, but lacks explanation of 'current session' and the optional model parameter. Output schema exists, which somewhat compensates, but incomplete for a full understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the only parameter 'model' is not mentioned in the description, leaving its purpose and effect unclear. The description should explain how the model parameter influences the report.

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 clearly states it is a 'token savings dashboard' showing cache hits, tokens saved, and USD savings, which is distinct from sibling tools like cache_lookup or estimate_tokens.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like cache_lookup or estimate_tokens. No explicit when-not or context for usage.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 9 tool updatesv0.2.0
    • First observedanalyze_context
    • First observedcache_invalidate
    • First observedcache_lookup
    • First observedcache_store
    • First observedcompress_prompt
    • First observeddeduplicate_messages
    • First observedestimate_tokens
    • First observedroute_model
    • First observedsavings_report

TDQS

A3.9/5.0
Disambiguation5/5

Each tool targets a distinct operation: caching (store/lookup/invalidate), compression, deduplication, analysis, estimation, model routing, and reporting. No two tools overlap in purpose.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., cache_store, compress_prompt, route_model), making them predictable and easy to differentiate.

Tool Count5/5

With 9 tools, the server covers the core aspects of token optimization without being excessive. Each tool serves a clear need within the domain.

Completeness4/5

The tool set covers analysis, caching, compression, deduplication, estimation, routing, and reporting. The only minor gap is the lack of a cache listing tool, but the core workflow is complete.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

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/DCx7C5/token-optimization-mcp'

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