Skip to main content
Glama

TOON MCP Server

npm version License: MIT

MCP (Model Context Protocol) server for TOON (Token-Oriented Object Notation) encoding. Reduce LLM token usage by 50-70% when sending structured data.

What is TOON?

TOON is a compact data format optimized for LLM input. Instead of repeating field names for every object, it uses a header-based format:

JSON (1041 tokens):

[
  {"id": 1, "name": "Product A", "price": 99.99},
  {"id": 2, "name": "Product B", "price": 149.99}
]

TOON (389 tokens):

[id,name,price]
1,Product A,99.99
2,Product B,149.99

Result: 62% fewer tokens = 62% cost savings

Related MCP server: TOON MCP Server

Installation

Quick Start (npx - no install needed)

Add to your MCP settings:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "toon": {
      "command": "npx",
      "args": ["-y", "toon-mcp-server"]
    }
  }
}

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

{
  "mcpServers": {
    "toon": {
      "command": "npx",
      "args": ["-y", "toon-mcp-server"]
    }
  }
}

Global Install

npm install -g toon-mcp-server

Then add to your MCP settings:

{
  "mcpServers": {
    "toon": {
      "command": "toon-mcp"
    }
  }
}

As Claude Code Skill

# Download the skill
curl -o ~/.claude/skills/toon.md https://raw.githubusercontent.com/elminson/toon-mcp/main/skills/toon.md

Then use /toon in Claude Code.

Available Tools

toon_encode

Convert data to TOON format.

Supported formats: JSON, CSV, TSV, XML, HTML tables, YAML

Input: [{"name":"Alice","age":30},{"name":"Bob","age":25}]
Output: [name,age]
        Alice,30
        Bob,25

toon_decode

Convert TOON back to JSON.

toon_analyze

Analyze data and show potential token/cost savings.

toon_optimize_prompt

Find data sections in a prompt and convert them to TOON automatically.

Usage Examples

In Claude Desktop/Code (with MCP)

Just ask Claude to use the tools:

  • "Encode this JSON to TOON: [...]"

  • "Analyze how much I'd save converting this data to TOON"

  • "Optimize this prompt for token efficiency"

Programmatic (Node.js)

const { ToonEncoder } = require('toon-mcp-server/src/toon-encoder');

// Encode
const data = [
  { id: 1, name: 'Test', price: 99.99 },
  { id: 2, name: 'Test 2', price: 149.99 },
];
const toon = ToonEncoder.encode(data);

// Get stats
const json = JSON.stringify(data);
const stats = ToonEncoder.getStats(json, toon);
console.log(stats.savings.percent); // "64.5%"

// Decode
const decoded = ToonEncoder.decode(toon);

Benchmarks

Tested with OpenAI GPT-4o-mini:

Dataset Size

JSON Tokens

TOON Tokens

Savings

5 items

383

192

49.9%

20 items

1,394

530

62%

50 items

3,412

1,204

64.7%

100 items

6,800

2,400

~65%

Cost Savings at Scale

Volume

GPT-4o-mini

GPT-4o

Claude Sonnet

1M requests

$489 saved

$8,158 saved

$9,789 saved

10M requests

$4,890 saved

$81,580 saved

$97,890 saved

When to Use TOON

Best for:

  • Arrays of objects with same structure (tables, lists, records)

  • API responses, database results

  • Large datasets sent to LLMs

  • Cost optimization at scale

⚠️ Less effective for:

  • Deeply nested, non-uniform data

  • Small payloads (<5 items)

  • Data with many unique field structures

Contributing

Pull requests welcome! Please open an issue first to discuss changes.

License

MIT

Available Tools

4 tools
toon_analyzeC

Analyze data and show potential token savings with TOON encoding.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataYesThe data to analyze
formatNoInput format (default: auto-detect)

TDQS

C2.9/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 the full burden of behavioral disclosure. It states the tool analyzes data and shows potential token savings, but doesn't describe how this is done (e.g., computational method, output format, performance implications). It also omits details like whether it's read-only, if it has side effects, rate limits, or error handling. For a tool with no annotations, this is a significant gap in transparency.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('Analyze data') and outcome ('show potential token savings'), making it easy to parse. Every part of the sentence contributes to understanding the tool's purpose.

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

Completeness2/5

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

Given the complexity of analyzing data for token savings and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'TOON encoding' is, how token savings are calculated, or what the output looks like (e.g., a report, numerical value, comparison). For a tool with no structured output and behavioral gaps, more context is needed to guide effective use.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('data' and 'format'), including an enum for 'format'. The description doesn't add any meaningful semantic details beyond what the schema provides (e.g., it doesn't explain what 'token savings' means in context or how 'format' affects analysis). Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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 clearly states the tool's purpose: 'Analyze data and show potential token savings with TOON encoding.' It specifies the verb ('analyze'), resource ('data'), and outcome ('show potential token savings'), which is specific and actionable. However, it doesn't explicitly differentiate this tool from its siblings (e.g., toon_encode, toon_decode, toon_optimize_prompt), which would be needed for a score of 5.

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 provides no guidance on when to use this tool versus its siblings. It doesn't mention alternatives, prerequisites, or contextual cues for selection. For example, it doesn't clarify if this should be used before encoding, after decoding, or in comparison to optimization. This lack of usage context leaves the agent without direction.

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

toon_decodeC

Decode TOON format back to JSON object or array.

ParametersJSON Schema
NameRequiredDescriptionDefault
toonYesTOON-formatted data to decode

TDQS

C2.9/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 the full burden of behavioral disclosure. It states the tool decodes TOON to JSON, but doesn't cover error handling (e.g., invalid input), performance traits (e.g., speed, memory usage), or output specifics (e.g., structure, size limits). This is a significant gap for a tool with no annotation coverage.

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 a single, efficient sentence: 'Decode TOON format back to JSON object or array.' It is front-loaded with the core action and output, with zero wasted words. Every part of the sentence contributes essential information.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't address what happens on success (e.g., JSON structure) or failure (e.g., error messages), nor does it provide context about TOON format or decoding constraints. For a tool with no structured support, more behavioral and output details are needed.

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?

The input schema has 100% description coverage, with the parameter 'toon' documented as 'TOON-formatted data to decode'. The description adds no additional meaning beyond this, as it doesn't explain TOON format details or decoding nuances. With high schema coverage, the baseline score of 3 is appropriate.

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 clearly states the tool's purpose: 'Decode TOON format back to JSON object or array.' It specifies the verb ('decode'), resource ('TOON format'), and output type ('JSON object or array'). However, it doesn't explicitly differentiate from sibling tools like 'toon_encode' or 'toon_analyze' beyond the decode vs encode distinction.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'toon_analyze' or 'toon_optimize_prompt', nor does it specify prerequisites such as needing TOON-formatted input. Usage is implied by the action 'decode', but no explicit context or exclusions are provided.

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

toon_encodeA

Convert data to TOON (Token-Oriented Object Notation) format to reduce token usage by 50-70%.

Supports: JSON, CSV, TSV, XML, HTML tables, YAML, and raw objects.

TOON uses a header-based format where field names are defined once:

  • JSON: {"id":1,"name":"test"} → [id,name]\n1,test

  • Reduces repetitive keys in arrays of objects

Use this before sending large datasets to LLMs to save tokens and costs.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataYesThe data to encode (JSON, CSV, XML, YAML, or other supported format)
formatNoInput format (default: auto-detect)

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the key behavioral trait: token reduction of 50-70%. However, it doesn't mention error handling, performance characteristics, or limitations (e.g., maximum input size). The description adds value by explaining the transformation logic and benefits, but lacks operational details.

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 efficiently structured: purpose first, supported formats second, technical explanation third, usage guidance last. Every sentence adds value—no redundancy or fluff. The four sentences each serve distinct functions: what it does, what it supports, how it works, and when to use it.

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 (data transformation with format detection), no annotations, and no output schema, the description does well by explaining the TOON format, benefits, and use case. However, it doesn't describe the output format (what TOON looks like beyond one example) or potential errors, leaving some gaps for an agent invoking it.

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 baseline is 3. The description adds context about supported formats ('JSON, CSV, TSV, XML, HTML tables, YAML, and raw objects') which complements the enum in the schema, but doesn't provide additional semantic details about the 'data' parameter beyond what the schema already states.

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: 'Convert data to TOON (Token-Oriented Object Notation) format to reduce token usage by 50-70%'. It specifies the exact transformation (conversion to header-based format) and distinguishes it from siblings like toon_decode (reverse operation) and toon_analyze/optimize_prompt (different functions).

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: 'Use this before sending large datasets to LLMs to save tokens and costs.' It specifies the optimal context (large datasets for LLMs) and implies when not to use it (small data where token savings are negligible). While it doesn't name alternatives, the context makes the primary use case clear.

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

toon_optimize_promptA

Optimize a prompt containing data for token efficiency.

Detects data structures within the prompt and converts them to TOON format, adding instructions for the LLM to understand the format.

Returns the optimized prompt with estimated token savings.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesThe full prompt containing data to optimize

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behaviors: it detects data structures, converts to TOON format, adds instructions for LLM understanding, and returns the optimized prompt with token savings. However, it lacks details on potential side effects, error handling, or performance characteristics like rate limits, which are important for a transformation 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?

The description is highly concise and well-structured: three sentences that efficiently cover purpose, process, and outcome without any wasted words. It's front-loaded with the main action and follows logically, making it easy to parse.

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 no annotations and no output schema, the description is moderately complete. It explains what the tool does and the expected return (optimized prompt with token savings), but lacks details on output format, error cases, or integration with sibling tools. For a transformation tool with one parameter, it's adequate but could benefit from more behavioral context.

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?

The input schema has 100% description coverage, with one parameter 'prompt' clearly documented as 'The full prompt containing data to optimize'. The description adds marginal value by reinforcing this as 'a prompt containing data to optimize', but doesn't provide additional semantics like examples or constraints beyond what the schema states.

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 clearly states the tool's purpose: 'Optimize a prompt containing data for token efficiency' with specific actions like detecting data structures, converting to TOON format, and adding instructions. It distinguishes from siblings like toon_analyze, toon_decode, and toon_encode by focusing on optimization rather than analysis or encoding/decoding, though it doesn't explicitly contrast them.

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 when token efficiency is needed for prompts containing data, but it doesn't explicitly state when to use this tool versus alternatives like toon_encode or toon_decode. No guidance on prerequisites, exclusions, or specific scenarios is provided, leaving usage context somewhat vague.

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. 4 tool updatesv1.0.0
    • First observedtoon_analyze
    • First observedtoon_decode
    • First observedtoon_encode
    • First observedtoon_optimize_prompt

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a distinct and non-overlapping purpose: toon_analyze assesses potential savings, toon_encode converts data to TOON format, toon_decode reverts TOON to original formats, and toon_optimize_prompt specifically handles prompt optimization. There is no ambiguity in tool selection.

Naming Consistency5/5

All tools follow a consistent 'toon_' prefix with a clear verb_noun pattern (e.g., toon_analyze, toon_encode, toon_decode, toon_optimize_prompt). This uniformity makes the tool set predictable and easy to understand.

Tool Count5/5

With 4 tools, the server is well-scoped for its purpose of TOON encoding and optimization. Each tool serves a specific function in the data processing workflow, and there are no extraneous or missing tools for this focused domain.

Completeness4/5

The tool set covers the core TOON workflow comprehensively: analyze, encode, decode, and optimize prompts. A minor gap might be the lack of a tool for batch processing or handling specific edge cases, but the existing tools allow agents to perform essential operations without dead ends.

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/elminson/toon-mcp'

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