Skip to content

feat: batch-categorize, tag income, name payees and edit plans from MCP - #60

Merged
donnes merged 3 commits into
mainfrom
t3/add-mcp-write-tools
Dec 2, 2026
Merged

donnes merged 3 commits into
mainfrom
t3/add-mcp-write-tools

Conversation

@donnes

@donnes donnes commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

An MCP client with the write grant still couldn't do the everyday cleanup: categorizing 33+ transactions meant 33 calls (each one recomputing every inference), it couldn't say whether a deposit was real income or money moving, name a payee, change the plan's envelopes or edit a recurrence's amount and date, and create_category_rule silently recategorized history.

This finishes the write tools on top of #59. Every write tool still exists only for a token with the spendle:write scope, which the person grants with Permitir alterações on /autorizar; no new scope. Read tools keep their names, paths and inputs; entries only gain a payee field.

Tool Input
update_transaction (changed) { entryIds: string[1..200], categoryId?, learnCategory?, note?: string|null, oneOff? } — unknown category or entry ids refuse the whole call before anything changes; categories go through a new atomic POST /api/category-decisions
create_category_rule (changed) { pattern, categoryId, matchMode?, direction?, applyToHistory?, dryRun? } — refuses a rule that would recategorize past movements unless applyToHistory: true
fix_income_tag (new) { entryId, kind: 'income'|'movement', categoryId?, counterpartEntryId? }
set_payee_alias (new) { entryId, name: string(≤80)|null } — names every movement with the same merchant signature; shown in /transacoes
update_plan (new) { strategyId?, allocation?: { essential, lifestyle, investment, reserve } (bps, sum 10000), monthlyIncomeTargetCents?, reserveMonths? }
update_recurrence (changed) { recurrenceId, active?, amountCents?, nextDate? }
mark_transfer, set_budget unchanged

Also fixes a crash when PUT /api/planning/settings got a partial update.

Not included: add_manual_account and add_planned_expense (separate features; they'd double this PR). No tool deletes transactions or moves money. A forward-only rule isn't possible in this model (rules are a projection over history), hence the applyToHistory gate.

Testing

  • Proof: MCP integration tests through real OAuth tokens cover each new tool, read-only refusal of all 8 write tools, a 35-entry batch, unknown category/entry ids changing nothing; server tests cover batch decisions and payee names. Review fixes each ship with a test that fails on the old code.
  • Passed both typechecks, lint, 26 web tests (MCP + data) and 140 server tests in affected areas.
  • Isolated QA with the real MCP client SDK: with Permitir alterações the client lists 25 tools and its batch category, note and payee name show in /transacoes on desktop and phone; without it, 17 read tools only.
  • Reviewed with review-loop: 2 rounds with gpt-6.2-astra, checked by gemini-4-neon. Verdict: approved. One finding declined: a sync landing between a rule's preview and creation could categorize that one new movement.

Created with Claude Opus 5.5 in Claude Code (T3 Code); reviewed by gpt-6.2-astra and gemini-4-neon.

donnes and others added 3 commits December 2, 2026 09:43
… payee names and plans

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e edits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@donnes
donnes merged commit 8749501 into main Dec 2, 2026
2 checks passed
@donnes
donnes deleted the t3/add-mcp-write-tools branch December 2, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant