{"slug": "mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350", "title": "MCP tool discovery eats 10,000 tokens. I got it down to 350.", "summary": "A developer created mcptoon, a CLI client that outputs Token-Optimized Object Notation (TOON) instead of JSON to reduce token overhead in MCP tool discovery and calls. The tool cuts tool discovery tokens from 2,034 to 62 for 96 tools, and in a real session reduced overhead from 47,200 to 8,100 tokens. It is designed to work with AI agents like Claude Code, Codex, and Cursor, and includes safety blocks for dangerous operations.", "body_md": "I use MCP servers with Claude Code every day. Last week I actually counted how many tokens get burned just on tool discovery.\n\n5 servers, 96 tools total. The JSON listing: **2,034 tokens**. On a 128K context window, that's before I've asked a single question.\n\n20 tool calls later, each wrapped in `{\"content\":[{\"type\":\"text\",\"text\":\"...\"}]}`\n\n— another 40,000 tokens of overhead. Brackets, quotes, commas, repeated `{\"type\":\"object\",\"properties\":`\n\ndeclarations.\n\nI wrote [mcptoon](https://github.com/activeing123/mcptoon) to deal with this. It's a CLI client that outputs TOON (Token-Optimized Object Notation) instead of JSON. The idea is dumb on purpose: the LLM doesn't need `{\"type\":\"object\",\"properties\":`\n\nto understand what a tool does. It just needs the tool name and the relevant fields.\n\n```\npip install mcptoon\n```\n\nZero dependencies. 50KB. Python 3.10+. Windows, macOS, Linux.\n\nHere's tool discovery from 2 MCP servers:\n\n**JSON (287 tokens)** — what every MCP client returns:\n\n```\n[\n  {\"name\": \"search_web\", \"description\": \"Search the web for information\",\n   \"inputSchema\": {\"type\": \"object\", \"properties\": {\"query\": {\"type\": \"string\", \"description\": \"Search query\"}, \"num_results\": {\"type\": \"number\", \"default\": 5}}, \"required\": [\"query\"]}},\n  {\"name\": \"fetch_url\", \"description\": \"Fetch content from a URL\",\n   \"inputSchema\": {\"type\": \"object\", \"properties\": {\"url\": {\"type\": \"string\"}}, \"required\": [\"url\"]}}\n]\n```\n\n**TOON (5 tokens)** — what mcptoon returns:\n\n```\nsearch_web fetch_url\n```\n\nFor tool discovery, the agent just needs to know what tools exist. Not the full schema every single time.\n\nWhen it does need the schema, TOON with full details is still 60% smaller:\n\n```\nname:search_web|description:Search_the_web|inputSchema:type:object|properties:query:type:string|description:Search_query|num_results:type:number|default:5|required:query||\nname:fetch_url|description:Fetch_content_from_a_URL|inputSchema:type:object|properties:url:type:string|required:url\n```\n\n| Operation | JSON tokens | TOON tokens | Saved |\n|---|---|---|---|\n| Tool discovery (96 tools) | 2,034 | 62 | 97% |\n| Tool result (structured) | 812 | 354 | 56% |\n| Tool result (raw HTML) | 1,023 | 912 | 11% |\n\nReal session: 5 servers, 20 tool calls. JSON overhead was 47,200 tokens. With mcptoon: 8,100 tokens. That's 39,100 tokens back.\n\n| JSON | TOON | What changed |\n|---|---|---|\n`{\"name\":\"search\",\"count\":3}` |\n`name:search\\ | count:3` |\n`[1, 2, 3]` |\n`1 2 3` |\nSpaces instead of brackets+commas |\n`true` / `false`\n|\n`T` / `F`\n|\n1 char vs 4-5 |\n`null` |\n`∅` |\n1 symbol vs 4 |\n`\"line1\\nline2\"` |\n`line1↲line2` |\n↲ instead of escape sequence |\n\nI tested this pretty thoroughly — Claude, GPT-4, and Gemini all parse TOON output correctly. The structure is recoverable from the compact form. What's not recoverable is the 1,900 tokens you spent on `{\"type\":\"object\",\"properties\":`\n\nrepeated 96 times.\n\n```\npip install mcptoon\nmcptoon init\nmcptoon add fetch --stdio npx -y @modelcontextprotocol/server-fetch\nmcptoon manifest --toon\n# → fetch:fetch\n\nmcptoon call fetch fetch '{\"url\":\"https://example.com\"}' --toon\n```\n\nSet `MCPTOON_AGENT_TYPE=claude`\n\nand it auto-selects `--toon`\n\non every call.\n\nmcptoon is a CLI tool. If your agent runs shell commands, it can use it. No SDK, no plugin.\n\n| Agent | Setup |\n|---|---|\n| Claude Code |\n`mcptoon` in SKILL.md |\n| Codex |\n`mcptoon` in AGENTS.md |\n| Cursor |\n`mcptoon` in .cursorrules |\n| OpenCode |\n`mcptoon` in custom commands |\n| CatPaw |\n`mcptoon` in skill files |\n\nOne config file (`~/.mcptoon/config.json`\n\n), every agent shares it. Add a server, all agents see it instantly.\n\nDangerous operations get blocked by default:\n\n``` bash\n$ mcptoon call db delete_table '{\"name\":\"users\"}'\nError [CONFIRMATION_REQUIRED]: Dangerous operation needs confirmation\n\n$ mcptoon call db delete_table '{\"name\":\"users\"}' --destructive\n# now it runs\n```\n\nPatterns blocked: `delete`\n\n, `drop`\n\n, `purge`\n\n, `wipe`\n\n, `kill`\n\n, `force=true`\n\n, `confirm=true`\n\n. Pass `--destructive`\n\nto override.\n\n``` python\nfrom mcptoon.client import MCPClient\nfrom mcptoon.output import toon\n\nwith MCPClient(stdio=[\"npx\", \"-y\", \"@modelcontextprotocol/server-fetch\"]) as c:\n    tools = c.list_tools()\n    print(toon(tools))  # compact TOON\n    result = c.call_tool(\"fetch\", {\"url\": \"https://example.com\"})\n    print(toon(result))\nsrc/mcptoon/\n├── cli.py        # CLI entry + arg parsing\n├── client.py     # MCPClient — stdio + HTTP transport\n├── router.py     # Tool routing, safety checks\n├── output.py     # TOON / JSON / compact rendering\n├── cache.py      # Schema cache (5-min TTL)\n└── usage.py      # Local usage tracking\n```\n\n1,700 lines. Zero third-party imports. I have a personal grudge against dependencies for something this simple.\n\n| mcptoon | mcp-cli | raw MCP SDK | |\n|---|---|---|---|\n| Token savings | 97% manifest, 56% results | 0% | 0% |\n| All agents | yes | Claude only | varies |\n| Dependencies | 0 | 5-20 | 3-8 |\n| Install size | 50KB | 50MB+ | 10MB |\n| Platforms | Win+Mac+Linux | Linux/Mac | varies |\n\nGitHub: [activeing123/mcptoon](https://github.com/activeing123/mcptoon)\n\nPyPI: [mcptoon](https://pypi.org/project/mcptoon/)\n\nLicense: Apache 2.0 | Dependencies: 0 | Tests: 98 passing in 0.09s\n\nRepo is [here](https://github.com/activeing123/mcptoon). Issues and feedback welcome — I'm especially curious if anyone has measured MCP token overhead in production and has different numbers than mine.", "url": "https://wpnews.pro/news/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350", "canonical_source": "https://dev.to/mcptokensaver/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350-3lif", "published_at": "2026-08-10 09:03:51+00:00", "updated_at": "2026-08-10 09:16:09.504446+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "artificial-intelligence"], "entities": ["mcptoon", "Claude Code", "Codex", "Cursor", "OpenCode", "CatPaw", "MCP"], "alternates": {"html": "https://wpnews.pro/news/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350", "markdown": "https://wpnews.pro/news/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350.md", "text": "https://wpnews.pro/news/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350.txt", "jsonld": "https://wpnews.pro/news/mcp-tool-discovery-eats-10000-tokens-i-got-it-down-to-350.jsonld"}}