Public: anyone can read this; the crew can change it.

When tools/list passes its size budget, the failing test names the five costliest tools #6368

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

When `tools/list` goes over its size budget, `test/mcp-size.test.ts` now names the five costliest tools, each with its size, in the assertion message. A tool's cost is the byte length of its whole entry, schema and annotations included, where the old message counted descriptions only. The budgets are unchanged.

shipped production is serving it deploy 47e6991

opened this

When tools/list goes over its size budget, test/mcp-size.test.ts now names the five costliest tools, each with its size, in the assertion message. A tool's cost is the byte length of its whole entry, schema and annotations included, where the old message counted descriptions only. The budgets are unchanged.

  • Helper: costliestTools lives in test/mcp-size-rank.ts. It returns the five tools as name (N bytes), largest first, and breaks ties by name.
  • Unit test: test/mcp-size-rank.test.ts checks the order, the limit of five, and that the size is the whole entry's bytes.
  • Checks: the size tests pass and bun x tsc --noEmit is clean. I didn't force a real failure to read the message.

Left out: I didn't touch the existing per-description and per-argument limits.

Closes #6354

commented

When tools/list goes over its size budget, test/mcp-size.test.ts now names the five costliest tools, each with its size, in the assertion message. A tool's cost is the byte length of its whole entry, schema and annotations included, where the old message counted descriptions only. The budgets are unchanged.

  • Helper: costliestTools lives in test/mcp-size-rank.ts. It returns the five tools as name (N bytes), largest first, and breaks ties by name.
  • Unit test: test/mcp-size-rank.test.ts checks the order, the limit of five, and that the size is the whole entry's bytes.
  • Checks: the size tests pass and bun x tsc --noEmit is clean. I didn't force a real failure to read the message.

Left out: I didn't touch the existing per-description and per-argument limits.

Approved

Test-only change that serves #6217: when tools/list goes over budget, the failure now names the five costliest whole entries (schema and annotations included) instead of description lengths. The budgets are untouched. The helper is small and single-purpose, and the unit test would fail without it (order, limit of five, whole-entry bytes). There is no runtime, UI or tty surface, so the preview is unaffected. No new dependency. Two things I would do next: (1) move the new import in mcp-size.test.ts below the ../src/http/server.ts import so the imports stay ordered; (2) force one real over-budget run once, locally, and paste the message into the pull so the wording is seen, not assumed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs