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

GET /api/v1/forges/sizes and MCP `sizes` say what small, medium and large mean #3215

Parked opened this
Closed without merging

GET /api/v1/forges/sizes and the MCP tool sizes now answer what small, medium and large mean. The new test passes. I did not get a type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem" and I didn't retry it.

Notes

stopped parked by the crew deploy 775dfdf

opened this

GET /api/v1/forges/sizes and the MCP tool sizes now answer what small, medium and large mean. The new test passes. I did not get a type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem" and I didn't retry it.

  • HTTP: the endpoint needs no sign-in. It carries a weak ETag (from src/http/etag.ts), answers 304 to If-None-Match, and sends cache-control: public, max-age=300.
  • MCP: sizes is a read-only tool in src/http/mcp.ts and returns the same JSON. Like the other MCP tools, it needs a signed-in token.
  • JSON shape: { sizes: [{ size, cpu, memoryMiB, diskMiB, says }], default: "small" }. sizesView() in src/spawn/sizes.ts builds it from the SIZES table.
  • Sentences: the sentences are mine, kept in that same file next to the table, so they will need a person's eye.
  • Tests: test/sizes-api.test.ts checks that the HTTP answer and the MCP answer both equal sizesView(). It also checks that each row matches SIZES, and that the ETag gives a 304. test/mcp-discovery-walk.test.ts still passes alongside it. I did not run the whole suite.

I left out Vary and HEAD handling beyond what the router already does, and added no dependencies.

To try it: curl -i $FORGE_URL/api/v1/forges/sizes, then repeat with -H 'if-none-match: <etag>'.

Closes #3205

2 earlier comments
commented

GET /api/v1/forges/sizes and the MCP tool sizes now answer what small, medium and large mean. The new test passes. I did not get a type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem" and I didn't retry it.

  • HTTP: the endpoint needs no sign-in. It carries a weak ETag (from src/http/etag.ts), answers 304 to If-None-Match, and sends cache-control: public, max-age=300.
  • MCP: sizes is a read-only tool in src/http/mcp.ts and returns the same JSON. Like the other MCP tools, it needs a signed-in token.
  • JSON shape: { sizes: [{ size, cpu, memoryMiB, diskMiB, says }], default: "small" }. sizesView() in src/spawn/sizes.ts builds it from the SIZES table.
  • Sentences: the sentences are mine, kept in that same file next to the table, so they will need a person's eye.
  • Tests: test/sizes-api.test.ts checks that the HTTP answer and the MCP answer both equal sizesView(). It also checks that each row matches SIZES, and that the ETag gives a 304. test/mcp-discovery-walk.test.ts still passes alongside it. I did not run the whole suite.

I left out Vary and HEAD handling beyond what the router already does, and added no dependencies.

To try it: curl -i $FORGE_URL/api/v1/forges/sizes, then repeat with -H 'if-none-match: <etag>'.

commented

GET /api/v1/forges/sizes and the MCP tool sizes now return what small, medium and large mean, and the type error that failed the check is fixed. I could not run the type check here, so the forge's check on this push is the first real one. bun install and tsc both failed in this sandbox with "bun is unable to write files to tempdir: ReadOnlyFileSystem". bun test test/sizes-api.test.ts passes.

What changed

  • src/spawn/sizes.ts has a new sizesView() that builds the answer from the SIZES table: each size's CPU, memory and disk, plus one sentence, and the default size. The sentences are mine, so someone should check the wording.
  • GET /api/v1/forges/sizes needs no sign-in. It sends a weak ETag, answers 304 to If-None-Match, and sets cache-control: public, max-age=300.
  • The MCP tool sizes returns the same JSON from the same function. Like the other MCP tools, it needs a signed-in token.

The failure Object.keys(SIZES) is typed string[], and toEqual wanted Size[] on line 49 of test/sizes-api.test.ts. I cast the keys to Size[]; the import now includes type Size.

Tests test/sizes-api.test.ts checks that the HTTP answer and the MCP answer both equal sizesView(), and that each row matches SIZES. It also checks the ETag and the 304.

Left out No dependencies were added.

Try it curl -i $FORGE_URL/api/v1/forges/sizes, then repeat with -H 'if-none-match: <etag>'.

commented

Parked by the crew: the check failed ("the forge over MCP > it speaks the protocol: initialize, a notification, ping, tools/list") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs