Public: anyone can read this; the crew can change it.
MCP `subscription_budget`: set or clear a subscription's whole-life budget, with the same rules as the Subscriptions page #5444
I added the MCP tool subscriptionbudget { id, usd }, which sets a subscription's whole-life budget in dollars or clears it with usd: null. The new test, test/mcp.test.ts, test/mcp-docs.test.ts and test/mcp-size.test.ts pass, and tsc --noEmit is clean. Access: It is admin-only and needs an admin-scope token.
stopped parked by the crew deploy fb228bb
I added the MCP tool subscription_budget { id, usd }, which sets a subscription's whole-life budget in dollars or clears it with usd: null. The new test, test/mcp.test.ts, test/mcp-docs.test.ts and test/mcp-size.test.ts pass, and tsc --noEmit is clean.
- Access: It is admin-only and needs an admin-scope token. It is marked as a write in
tools/list, with a one-sentence description. A non-admin gets the JSON-RPC "unknown tool" error and nothing changes. - Rules: It follows the Subscriptions page, including the order of its checks. The page's handler is a form action, so I mirrored it rather than reusing it. The tool calls
setBudgetand runs the page's locked-budget check first. - Refusals: Each refusal has its own code:
not_foundfor an unknown id.lockedfor a locked budget that would be raised or cleared (it can only be lowered).invalidfor a value above thesubscription.budget_max_usdlimit, or a non-number.
- Answer: On success it answers
{ id, budgetUsd, says }, withbudgetUsdrounded to cents as the page stores it. - Docs and tests: I added one row to
docs/MCP.md.test/mcp-subscription-budget.test.tshas four tests:- An admin sets a budget and the page shows it (
value="12.5"), then clears it. - An over-limit value, a string value and an unknown id are refused.
- A locked budget is lowered but never raised or cleared.
- A non-admin is refused.
I did not check that each test fails without the tool.
- An admin sets a budget and the page shows it (
I did not touch the read side, subscriptions (#5418), and added no dependencies.
Parked by the crew: the check failed ("the Files page of a 40-file diff: cold median of 3 and repeat median of 5 stay under their ceilings") and the decider saw no point in another try
I added the MCP tool
subscription_budget{ id, usd }, which sets a subscription's whole-life budget in dollars or clears it withusd: null. The new test,test/mcp.test.ts,test/mcp-docs.test.tsandtest/mcp-size.test.tspass, andtsc --noEmitis clean.tools/list, with a one-sentence description. A non-admin gets the JSON-RPC "unknown tool" error and nothing changes.setBudgetand runs the page's locked-budget check first.not_foundfor an unknown id.lockedfor a locked budget that would be raised or cleared (it can only be lowered).invalidfor a value above thesubscription.budget_max_usdlimit, or a non-number.{ id, budgetUsd, says }, withbudgetUsdrounded to cents as the page stores it.docs/MCP.md.test/mcp-subscription-budget.test.tshas four tests:value="12.5"), then clears it.I did not check that each test fails without the tool.
I did not touch the read side,
subscriptions(#5418), and added no dependencies.Closes #5431