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

The MCP size test says how many bytes are left, and docs/MCP.md says a new door extends a tool before it becomes one #5050

Merged opened this

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

Merged

scout/forge:scout/5033-the-mcp-size-test-says-how-many-bytes-ar → main 2 commits fork 2 threads · 2 unresolved

  • Merged. scout/5033-the-mcp-size-test-says-how-many-bytes-ar was merged into main as d52eb49.

Review

Sign in to review this change.
2 files changed +20 −2
docs/MCP.md +12
@@ -79,6 +79,18 @@ for a tunnel and a forge that sleeps.
7979 | `plan` | `{ app, issues }`: open up to 12 linked issues, all or none (see below) | yes |
8080 | `prompts` | `{ repo, action, kind?, token?, at?, id? }`: list, add, run or remove an app's prompt sources (Instagram), as the `…/prompts` API does; the token goes in once and is never shown; listed only for an admin-scope token, and only the repository's admin may use it | yes |
8181
82 ### Room for a new tool
83
84 Every session pays for `tools/list` first, so `test/mcp-size.test.ts` holds it
85 to a 40,000-byte ceiling and a 37,000-byte headroom (the answer an admin gets,
86 the largest). Measure before you push with `bun test test/mcp-size.test.ts`;
87 a failure names the bytes over and the longest descriptions.
88
89 - A new door is an `action` or `kind` on the tool that already owns the
90 resource before it is a new tool.
91 - A new tool's description is one sentence.
92 - The ceiling is the owner's: never raise it in a feature pull.
93
8294 Answers are JSON in a text block; most carry a `says` sentence short enough
8395 to relay as it is.
8496
test/mcp-size.test.ts +8 −2
@@ -2,6 +2,12 @@
22 * Every harness session pays for `tools/list` before it does anything, so
33 * the answer has a ceiling: past it, the longest descriptions are named so
44 * the next cut is obvious.
5 *
6 * Measure locally with `bun test test/mcp-size.test.ts`. A failure says how
7 * many bytes the answer is, how many it is over, and the longest
8 * descriptions. Before adding a tool, extend an existing one with an
9 * `action` or `kind` (docs/MCP.md, "Room for a new tool"). The ceilings are
10 * the owner's: do not raise them in a feature pull.
511 */
612 import { afterAll, beforeAll, expect, test } from "bun:test";
713 import { mkdtemp, rm } from "node:fs/promises";
@@ -69,10 +75,10 @@ test("tools/list stays under 40 KB, with 3 KB of headroom (37,000 bytes)", async
6975 .slice(0, 5);
7076 expect(
7177 bytes,
72 `tools/list is ${bytes} bytes, over ${CEILING}; the five longest descriptions: ${longest.join(", ")}`,
78 `tools/list is ${bytes} bytes, ${bytes - CEILING} over the ${CEILING} ceiling; the five longest descriptions: ${longest.join(", ")}`,
outdated

Size is stated twice: remove "; the new answer has ${bytes} bytes".

7379 ).toBeLessThanOrEqual(CEILING);
7480 expect(
7581 bytes,
76 `tools/list is ${bytes} bytes, over the ${HEADROOM_CEILING} headroom; the five longest descriptions: ${longest.join(", ")}`,
82 `tools/list is ${bytes} bytes, ${bytes - HEADROOM_CEILING} over the ${HEADROOM_CEILING} headroom (${CEILING - bytes} left under the ceiling); the five longest descriptions: ${longest.join(", ")}`,
outdated

Same duplicate here; remove "; the new answer has ${bytes} bytes".

7783 ).toBeLessThanOrEqual(HEADROOM_CEILING);
7884 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs