Measure the hidden token bill of MCP and agent tool catalogs.
Project description
tool-tax
See how many tokens your agent tools burn before the user even asks a question.
tool-tax scans MCP-style tool catalogs, JSON/YAML tool manifests, and OpenAPI
files. It can also probe a live MCP stdio server with tools/list. It shows
the full schema cost, ranks the heaviest tools, diffs catalog changes in pull
requests, writes a slim tool index for progressive loading, and can run a
small stdio proxy that lazy-loads upstream schemas.
pipx install tool-tax
tool-tax mcp -- npx -y @modelcontextprotocol/server-filesystem /tmp
tool-tax scan examples
tool-tax diff old-tools.json new-tools.json
tool-tax pack examples --out .tool-tax
Example result:
Tools: 14
Full tool tax: 2,102 est. tokens
Slim index: 647 est. tokens
Potential savings: 1,455 est. tokens (69.2%)
Why
Agents keep getting more tools. MCP servers, browser tools, GitHub tools, database tools, and internal APIs all ship long schemas. If every schema is loaded up front, your agent pays a context tax before it starts working.
tool-tax gives that tax a number.
What It Does
- Finds tool definitions in JSON, YAML, and OpenAPI files.
- Probes live MCP stdio servers through
initialize+tools/list. - Estimates token cost for each tool schema.
- Ranks the most expensive tools.
- Diffs base/head catalogs for PR budget checks.
- Generates a slim
tool-index.jsonplus separate schema files. - Runs a stdio proxy with
list_tools,get_schema, andcall_toolwrappers. - Fails CI when the tool catalog grows past a budget.
- Posts or updates a GitHub PR report comment when configured.
Install
From PyPI:
pipx install tool-tax
From GitHub:
pipx install git+https://github.com/SihyeonJeon/tool-tax.git@v0.5.0
From a clone:
git clone https://github.com/SihyeonJeon/tool-tax.git
cd tool-tax
python3 -m pip install -e .
Installs one runtime dependency: PyYAML.
Use
Scan a repo:
tool-tax scan .
Scan a live MCP stdio server:
tool-tax mcp -- npx -y @modelcontextprotocol/server-filesystem /tmp
tool-tax mcp --pack-out .tool-tax-mcp -- npx -y @modelcontextprotocol/server-memory
Run the lazy-schema proxy:
tool-tax proxy -- npx -y @modelcontextprotocol/server-filesystem /tmp
Write Markdown and JSON reports:
tool-tax scan examples --format md --out tool-tax-report.md
tool-tax scan examples --format json --out tool-tax-report.json
Create a progressive-loading pack:
tool-tax pack examples --out .tool-tax
That writes:
.tool-tax/
tool-index.json # small always-load index
schemas/*.json # full schemas loaded only when needed
Fail CI on tool bloat:
tool-tax scan mcp-tools.json --max-tokens 12000 --max-tool-tokens 750
Compare a pull request:
tool-tax diff base-tools.json head-tools.json --max-delta-tokens 500
Slice a large OpenAPI file before scanning or packing:
tool-tax scan openapi.json --tag payments
tool-tax scan openapi.json --path /v1/payment_intents
tool-tax pack openapi.json --operation "PostPayment*" --out .tool-tax-payments
Use it as a GitHub Action:
- uses: SihyeonJeon/tool-tax@v0.5.0
with:
path: .
max-tokens: "12000"
max-tool-tokens: "750"
Output
# Tool Tax Report
Grade: **lean**
| Metric | Value |
| --- | ---: |
| Tools | 7 |
| Full tool tax | 1,144 est. tokens |
| Slim index | 309 est. tokens |
| Potential savings | 835 est. tokens (73.0%) |
| Worst tool | 255 est. tokens |
Supports
- Live MCP stdio servers
- Lazy-schema MCP stdio proxy
- MCP-style JSON/YAML tool arrays
- Agent tool manifests with
name,description, andinputSchema - OpenAPI
pathsoperations - OpenAPI slicing by
--tag,--path, and--operation - Nested JSON catalogs
- GitHub Step Summary and PR comment reports
Benchmarks
| Catalog | Tools | Full tool tax | Slim index | Potential savings |
|---|---|---|---|---|
| Live MCP Filesystem | 14 | 2,102 | 647 | 69.2% |
tool-tax proxy for MCP Filesystem |
3 | 260 | 136 | 47.7% |
| Live MCP Memory | 9 | 1,324 | 340 | 74.3% |
| Live MCP Sequential Thinking | 1 | 858 | 46 | 94.6% |
| GitHub REST API | 1,184 | 366,962 | 70,996 | 80.7% |
| Stripe OpenAPI | 587 | 649,797 | 28,047 | 95.7% |
Direct-vs-proxy upfront schema tax for MCP Filesystem: 2,102 -> 260 estimated
tokens, or 87.6% less upfront tool schema.
Repo Shape
src/tool_tax/ # library + CLI
tests/ # unittest smoke coverage
examples/ # sample MCP/OpenAPI catalogs and reports
docs/ # trend scan and repo structure notes
Claim
This tool does not claim provider bill reduction from the estimator alone. It measures the up-front schema tax, creates a smaller index, and includes an experimental stdio proxy that exposes three wrapper tools so upstream schemas can be fetched only when needed.
The proxy is intentionally narrow: stdio, tools/list, and tools/call. It is not a full MCP gateway for resources, prompts, streamable HTTP, or auth.
More
- Roadmap
- Public scan gallery
- Proxy benchmark
- PyPI publish notes
- Star forecast and comparison set
- Launch kit
- Trend scan
- Repo shape scan
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tool_tax-0.5.0.tar.gz.
File metadata
- Download URL: tool_tax-0.5.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
653953eac6b2ba89f1da47b5a54f3d7b495c92e66e319cbe30e244550d3b1780
|
|
| MD5 |
c8c090bddc41f40bb18e3e3816a8f59c
|
|
| BLAKE2b-256 |
b3f1fae7ecc2cb87e21bc4223e74a1507daab6778c7e899c0fd29ddee6ee1206
|
Provenance
The following attestation bundles were made for tool_tax-0.5.0.tar.gz:
Publisher:
publish-pypi.yml on SihyeonJeon/tool-tax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tool_tax-0.5.0.tar.gz -
Subject digest:
653953eac6b2ba89f1da47b5a54f3d7b495c92e66e319cbe30e244550d3b1780 - Sigstore transparency entry: 1572905761
- Sigstore integration time:
-
Permalink:
SihyeonJeon/tool-tax@05c6f51f39cd2670cb89c0b07e1092c3e14994a3 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SihyeonJeon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@05c6f51f39cd2670cb89c0b07e1092c3e14994a3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tool_tax-0.5.0-py3-none-any.whl.
File metadata
- Download URL: tool_tax-0.5.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65abf7ecb40c948f1f7d46d8f0547db99a290b0ac7be6aae33ae6c6d50684be1
|
|
| MD5 |
481994089c7db0b0ba1dc4dbc6fcdba5
|
|
| BLAKE2b-256 |
6d58d5e18960f406d17fd2833528db9908fab1f10b205067deab43f961c7858a
|
Provenance
The following attestation bundles were made for tool_tax-0.5.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on SihyeonJeon/tool-tax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tool_tax-0.5.0-py3-none-any.whl -
Subject digest:
65abf7ecb40c948f1f7d46d8f0547db99a290b0ac7be6aae33ae6c6d50684be1 - Sigstore transparency entry: 1572905805
- Sigstore integration time:
-
Permalink:
SihyeonJeon/tool-tax@05c6f51f39cd2670cb89c0b07e1092c3e14994a3 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SihyeonJeon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@05c6f51f39cd2670cb89c0b07e1092c3e14994a3 -
Trigger Event:
release
-
Statement type: