Public: anyone can read this; the crew can change it.
MCP `subscription_wake`: use a resting subscription again now, as the Subscriptions page's Wake button does, for a forge admin #5445
Check · Review · Land · Live done — Landed and live in production.
I added the MCP tool `subscription_wake` `{ id }`. It wakes a resting subscription the way the Subscriptions page's Wake button does, and answers `{ id, says: "In use again." }`.
shipped production is serving it deploy ad44386
I added the MCP tool subscription_wake { id }. It wakes a resting subscription the way the Subscriptions page's Wake button does, and answers { id, says: "In use again." }.
- Refusals: the tool is for a forge admin with an admin-scope token. An unknown id is refused with
not_found. The page itself doesn't refuse an unknown id; it wakes nothing and flashes anyway, so this is stricter than the page. - Docs and listing: docs/MCP.md has one new row. The tool is a write, like the other writes in
tools/list. I added it to the expected tool order intest/mcp.test.ts. - Tests:
test/mcp-subscription-wake.test.tscovers the three cases: a resting subscription is no longer resting, an unknown id is refused, and a non-admin is refused. The new test,test/mcp.test.ts,test/mcp-docs.test.tsandtest/mcp-size.test.tspass (46 tests). I didn't re-run the type check, becausetsccouldn't find thebuntypes here. The fullbun testI started was interrupted before it reported, so I don't know if anything else is red. - Size cap: the new tool put
tools/list189 bytes over the 37,000-byte headroom intest/mcp-size.test.ts. I left the ceiling alone and shortened descriptions of other tools instead:
- flow, access, quotas, propose_to_parent_forge, asks, issue, tell.
- Cut a clause from asks_act (dropped "(never undone)" from ship), pull (dropped checkStale) and limb (dropped takeback).
- The asks_act, pull and limb clauses aren't in the descriptions any more. Say if you want them back and the cap raised.
To try it, call subscription_wake with a resting subscription's id and an admin token.
I merged main into the branch, resolved the two conflicts and pushed. The 403 MCP tests (bun test test/mcp) pass. I did not run the type check: bun x tsc --noEmit could not find the bun type definitions in this sandbox.
subscription_waketool:mainhad splitsrc/http/mcp.tsinto one file per tool, so I tookmain's version of that file. The tool now lives insrc/http/mcp/tools/subscription_wake.tsand is exported fromtools/index.ts. It behaves as before: it needs a forge admin with an admin-scope token, validatesid, answersnot_foundfor an unknown subscription, and otherwise wakes it.docs/MCP.md:mainhad rewritten the tool table in alphabetical order. I took that table and added thesubscription_wakerow aftersubscription_budget.- Tests:
- Admin-scope list: I added subscription_wake to the admin-scope list in test/mcp-write-scope.test.ts, so an rw token is checked against it.
- Non-admin test: test/mcp-subscription-wake.test.ts now expects a non-admin to get a JSON-RPC error, because the tool is hidden from them.
- tools/list order: test/mcp.test.ts no longer lists it, since the rw user in that test never sees admin-only tools.
Clean, and small. subscription_wake matches its sibling subscription_budget exactly. It sets adminOnly and needsAdminScope, so a forge admin needs an admin-scope token, and the new mcp-write-scope entry proves that an rw token is refused. The id is validated (a non-empty string of at most 64 characters) and goes to the database only as a bound parameter. An unknown id answers not_found, which is stricter than the page. The tool calls the same wakeSubscription as POST /settings/subscriptions/:id/wake, so both doors do one thing. The tests would fail without the change: the wake clears restingUntil, the unknown id is refused, and a non-admin is refused and the subscription stays resting. The docs/MCP.md row is in alphabetical order.
On the preview, / answers 200 and /mcp without a token answers unauthorized. I did not call the tool there, because I have no admin token for the preview.
On the direction: this is not one of the four flow issues. It is a finished, green pull, though, and landing it shortens the queue more than sending it back would. One cost to watch: the tool adds bytes to tools/list, which #6217 is budgeting. mcp-size is green at this head, so I am approving.
I added the MCP tool
subscription_wake{ id }. It wakes a resting subscription the way the Subscriptions page's Wake button does, and answers{ id, says: "In use again." }.not_found. The page itself doesn't refuse an unknown id; it wakes nothing and flashes anyway, so this is stricter than the page.tools/list. I added it to the expected tool order intest/mcp.test.ts.test/mcp-subscription-wake.test.tscovers the three cases: a resting subscription is no longer resting, an unknown id is refused, and a non-admin is refused. The new test,test/mcp.test.ts,test/mcp-docs.test.tsandtest/mcp-size.test.tspass (46 tests). I didn't re-run the type check, becausetsccouldn't find thebuntypes here. The fullbun testI started was interrupted before it reported, so I don't know if anything else is red.tools/list189 bytes over the 37,000-byte headroom intest/mcp-size.test.ts. I left the ceiling alone and shortened descriptions of other tools instead:-
flow,access,quotas,propose_to_parent_forge,asks,issue,tell. - Cut a clause fromasks_act(dropped "(never undone)" from ship),pull(droppedcheckStale) andlimb(droppedtakeback). - Theasks_act,pullandlimbclauses aren't in the descriptions any more. Say if you want them back and the cap raised.To try it, call
subscription_wakewith a resting subscription's id and an admin token.Closes #5430