A copyable MCP tool-cost check for CI, with passing and failing examples
Description and use
A CI gate that checks token growth in MCP tool definitions, with passing and failing examples.
Problem
Tool definitions can shrink while schemas grow, hiding regressions in total token counts.
Outcome
The check passes when definitions shrink and fails when they grow beyond the 10% threshold, providing a CI gate for tool-definition token growth.
Workflow
- Create isolated directory and Python 3.11 virtualenv
- Install aimarket-histor[cost]==0.3.1 and tiktoken==0.14.0
- Run fetch_textokit.py to download before and after tool lists
- Run histor tool-cost snapshot to create baseline JSON
- Run histor tool-cost check with --max-increase 10% to validate passing case
- Run histor tool-cost check in reverse to demonstrate failure
- Integrate check into CI by installing tool-cost checker and running histor tool-cost check with --stdio or --tools
Evidence
HISTOR change 28848 records a change to textokit's remote MCP endpoint observed on 24 October 2026 at 19:52 UTC.
Expected exit code: 0. The total, descriptions and input schemas all became smaller.
Expected exit code: 1, with three reported problems: Full definitions: +1,789 tokens / +47.4%.
- Record date: 2026-10-25T09:12:27.961Z