Are you the author? Sign in to claim
Measure and improve the token-efficiency of agent-facing APIs (OpenAPI & MCP): a scorer, linter, the LAP profile, and a
· MIT · Changelog · Live leaderboard
Every agent session starts by paying for tool definitions it mostly won't use — and pays again for every call and every response. lap measures that, for any OpenAPI spec, live MCP server, or your own agent config: the token cost decomposed (A menu / B call / C result), a 0–100 grade, the rule violations driving the cost, and an applicable patch for the fixable ones. Free, neutral, reproducible — a measuring stick, not a product.
pip install "lap-score[mcp]"
lap stack # YOUR installed MCP servers: tokens paid before you type a word
lap score openapi.json # A/B/C decomposition + grade (also --mcp-url for live servers)
lap lint openapi.json # the violations driving the cost (also --mcp "cmd" for servers)
lap fix openapi.json --apply patched.json # fixable findings as an OpenAPI Overlay patch
lap badge openapi.json # shields.io grade badge for your README
$ lap stack
server kind tools menu tokens compact
time stdio 2 283 31
git stdio 12 1418 153
TOTAL 14 1701 184
Your agent pays ~1,701 tokens of tool menus at session start - before you type a word.
$ lap fix api/openapi.json --apply patched.json
[written] lap-overlay.yaml (6 action(s))
[written] patched.json (lint findings: 15 -> 3) # grade: B (72) -> A (91)
Everything is --json-able and CI-gateable (--max-menu-tokens, --diff --max-growth,
--fail-on; a composite GitHub Action and a Spectral ruleset
ship in-repo). Full CLI docs: lap/README.md.
No LLM in the loop for the core numbers — a deterministic pipeline anyone can rerun:
tools/list — the exact definitions (name, description, inputSchema) it advertises.
Credential-free: tool listing only, dummy env vars where a server won't boot without them.
(For OpenAPI, parse the spec instead.)ANTHROPIC_API_KEY for
Anthropic's own count_tokens. This is what a session pays before the first user message.Static menu costs (bucket A) are exact and reproducible; whether a deferred/tool-search
server actually works and what its per-call costs are is behavioral. For that half we go
beyond the static pipeline and run live A/Bs with real LLMs — actual billed calls, measuring
accuracy and tokens — kept clearly separate: Anthropic's Tool Search verified
at ~90%, its code-execution the one case that didn't hold up, a real
server's facade that held up 8.1× at equal accuracy. Run the static check
yourself: lap lint --mcp "npx -y your-server".
The leaderboard — 50 real public APIs, refreshed monthly. Their naive agent menus total ~11.2M tokens; rendering the same operations compactly recovers ~82% on average (lazy tool-search: ~86%). Nobody ships the compact form.
| API | naive menu (bucket A) | LAP compact | saved |
|---|---|---|---|
| Xero Accounting | 4,041,667 | 7,800 | +99% |
| Kubernetes | 2,864,414 | 45,015 | +98% |
| Amazon EC2 | 1,046,048 | 86,031 | +92% |
| …47 more, sortable, with history |
Real tools, not just our own variants — the same accounting pointed at the ecosystem, live, with billed calls where it matters:
Results that don't flatter the thesis ship as prominently as the ones that do — the verified/disputed registry of the field's headline claims is docs/FIELD.md, and the standard objections are priced out in CACHE-ECONOMICS ("isn't it cached?") and TOKENIZERS ("whose tokens?").
lap score/lint/fix give you a number, the
violations behind it, and a patch; the Action gates PRs that bloat the menu; lap badge
shows the grade in your README.lap stack audits what your own config burns; the leaderboard is
due-diligence before wiring up an API.lap/ — the pip-installable toolkit (start here).profile/ — the LAP profile: measured conventions, L1–L4 levels, the grade formula.experiments/ — the benchmark (pet-zoo testbed) + every measurement script behind the docs (leaderboard, spec-#2808 simulation, cache economics, tokenizer matrix, …).docs/ — the receipts: leaderboard (+ its MCP-server twin), real-tool tests, FIELD claims registry, SPEC-2808 input for the MCP spec discussion.spectral/ — the lint rules for existing Spectral setups.ROADMAP.md — the full staged history and what's next.0.8.x, pre-1.0, actively maintained, MIT — no telemetry, no paid tier, no company. Issues and PRs welcome: CONTRIBUTING.md covers dev setup and the house policies (vendor neutrality, claims need receipts), and there's a "Score my API" issue template — disputes of our numbers are explicitly invited.
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows