Open source · Prompt & Agent Workflows

Tool Schema Minifier

Measure tool schema size and identify safe descriptions that can be compressed.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

A long tool list is expensive. The usual way to shorten one is to delete whatever looks decorative -- and that is how a required list, an enum value, or the sentence telling a model to ask a person before deleting something quietly stops being there.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.

Run the checked-in example

# Compress, check, and write the copy: compact JSON, only when the run passes
node bin/tool-schema-minifier.mjs minify \
  --tools examples/tools.json \
  --out build/tools.min.json \
  --drop-annotations --human

# Check a copy produced somewhere else -- this one is deliberately broken
node bin/tool-schema-minifier.mjs verify \
  --tools examples/tools.json \
  --candidate examples/compressed-broken.json --human
echo "exit: $?"   # 1

# The machine-readable report, which is what stdout carries by default
node bin/tool-schema-minifier.mjs minify --tools examples/tools.json | jq .summary

npm run check     # lint, tests, both examples, and a packaging dry run

Read the result

examples/compressed-broken.json is the failing example. It drops a required list, removes an enum value, removes a parameter, and shortens an approval-governing description -- and the run exits 1 naming each one.

Scope

Every limit is enforced, wired to a flag and to --config, and reported by name. Nothing is truncated to fit: a document over a limit is refused whole and the run is incomplete.