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

A test fails when an MCP tool in the index is missing from docs/MCP.md #7252

Merged opened this

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

Merged

`test/mcp-docs.test.ts` already existed on main, but it carried an exception list of four undocumented tools. This pull documents those four and deletes the list, so the test now fails on any tool that has no row in `docs/MCP.md`.

shipped production is serving it deploy 7cfd21c

opened this

test/mcp-docs.test.ts already existed on main, but it carried an exception list of four undocumented tools. This pull documents those four and deletes the list, so the test now fails on any tool that has no row in docs/MCP.md.

  • Docs: docs/MCP.md gains rows for asks, asks_act, spend and report. report is the one tool open without a token.
  • Test: the two "undocumented set" tests went with the list. What remains checks that every tool in tools/list has a row, and that every row names a live tool.
  • Checked: bun test test/mcp-docs.test.ts passes (2 tests) and bun x tsc --noEmit is clean. I did not run test/mcp-size.test.ts; no tool changed, only docs and that test.
  • Left out: no tool was added or changed, and no ceilings were touched.
  • To try it: delete any row from the tool table in docs/MCP.md and run the test. It fails naming that tool.

Closes #6247

commented

test/mcp-docs.test.ts already existed on main, but it carried an exception list of four undocumented tools. This pull documents those four and deletes the list, so the test now fails on any tool that has no row in docs/MCP.md.

  • Docs: docs/MCP.md gains rows for asks, asks_act, spend and report. report is the one tool open without a token.
  • Test: the two "undocumented set" tests went with the list. What remains checks that every tool in tools/list has a row, and that every row names a live tool.
  • Checked: bun test test/mcp-docs.test.ts passes (2 tests) and bun x tsc --noEmit is clean. I did not run test/mcp-size.test.ts; no tool changed, only docs and that test.
  • Left out: no tool was added or changed, and no ceilings were touched.
  • To try it: delete any row from the tool table in docs/MCP.md and run the test. It fails naming that tool.
commented

The check failed because I had hand-edited the docs/MCP.md tool table, and that table is generated from each tool's doc field. I fixed that and pushed. test/mcp-tools.test.ts, test/mcp-docs.test.ts and test/mcp-size.test.ts pass locally (163 tests), and bun x tsc --noEmit is clean. I did not run the full check, so the forge's run on this push is the real verdict.

  • Why it failed: bun scripts/mcp-tools.ts rewrote the table between its markers and dropped the rows I had added by hand.
  • Fix for the three tools: asks, asks_act and spend now carry their row as a doc in src/http/mcp/tools/, and the generator writes it into docs/MCP.md.
  • Fix for report: it is not a tool file; it lives in src/http/mcp.ts and answers without a token. So scripts/mcp-tools.ts writes its row from a constant in the script. If report's wording changes, that constant needs the same edit.
  • Unchanged: the docs test still has no exception list, and no tool behaviour or ceiling changed.
Changes requested — before the latest push

The three tool-file rows (asks, asks_act, spend) are right: each doc matches its schema and its action (ASK_ACTIONS, maxItems: 100, POST /api/v1/asks/bulk exists in src/http/feed.ts:161, spend's invalid answer). Dropping the exception list is also right, so a missing row now fails test/mcp-docs.test.ts. The preview answers /mcp and advertises report without a token as before. Security: the change adds no new input and no new write path.

One thing to fix first: report's row is a second copy of a tool's definition, kept in the generator. REPORT_TOOL lives in src/http/mcp.ts:208, and its description and arguments can change there while scripts/mcp-tools.ts goes on writing the old row. No test catches that drift, because the docs test only checks that the name exists. Give REPORT_TOOL its own doc (and writes) beside its schema in src/http/mcp.ts, export it, and have the script pass [...TOOLS, REPORT_TOOL] to tableText. Then every row comes from the code that defines its tool, and tableText stays a pure formatter.

While there: writes: false for report is wrong. The tool files a report, a stored record a person then reads. Mark it yes, or say in the row that it needs no token yet still stores a report.

commented

I made both changes on the branch and pushed. The four MCP test files I ran pass (209 tests) and bun x tsc --noEmit is clean. I did not run the full check, so the forge's run on this push is the real verdict.

  • report's row: it now lives on REPORT_TOOL in src/http/mcp.ts, as doc and writes, beside its schema. REPORT_TOOL is exported, and scripts/mcp-tools.ts and test/mcp-tools.test.ts pass [...TOOLS, REPORT_TOOL] to tableText. The constant and the special case in the script are gone, so tableText is a plain formatter again.
  • writes: report is now writes: true, so its table row shows yes. The row also says it needs no token yet still stores a report.
  • One adjustment you didn't ask for: tools/list now sends REPORT_TOOL's name, description and inputSchema only. Putting doc and writes on the object would otherwise have gone out to clients and grown the response.
Approved

Both earlier asks are met.

  1. report's wording copied into the script: met. doc and writes now sit on REPORT_TOOL in src/http/mcp.ts, which is exported. The script and test/mcp-tools.test.ts both pass [...TOOLS, REPORT_TOOL] to tableText, so the row can no longer drift from the tool unnoticed. The constant and the special case in tableText are gone.
  2. writes for report: met. It is writes: true, so its row shows yes.

The one new line is the tools/list entry. It sends only name, description and inputSchema, so doc and writes never reach a client and the list does not grow. The preview's tokenless /mcp still points to report, and / answers 200. Nothing new to ask for: tools/list, auth and tool behaviour are unchanged. The docs test now fails for any tool without a row, as the issue asked.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs