MCP Idempotency and Confirmations
AI clients retry tool calls, and a model can act on text it shouldn't trust. Two safeguards keep write tools safe: every change carries an idempotency key, and a change to many things at once, or one that can't be undone, must be previewed and confirmed first.
Idempotency
Every write tool requires an
idempotency_key: a value of 8 to 128 characters, such as a UUID, generated
once for each intended change.
- A retry with the same key and the same arguments returns the original result without changing anything a second time.
- Reusing a key with different arguments, or for a different tool, returns
idempotency_key_reused. Generate a new key for a new change. - Keys are remembered for 24 hours, per token.
- A write that fails isn't remembered, so you can fix the arguments and retry with the same key.
A write tool called without a valid key returns idempotency_key_required.
For assign_budget, the key is also used as the funding run's own
idempotencyKey.
Confirming bulk changes
A call that changes many things at once, or that can't be undone, takes two
steps. Today that is assign_budget with more than one allocation, set_planned_amounts with more than one category, and every
call to merge_payees, rename_payee, the bulk tools (bulk_set_transaction_category,
bulk_set_transaction_payee, bulk_set_transaction_account,
bulk_set_transaction_cleared, bulk_update_transaction_tags,
bulk_approve_inbox_items and apply_payee_to_matching_inbox_items),
delete_payee_alias, remove_debt_plan_member, delete_category_target,
create_recurring_transaction and delete_recurring_transaction.
A rename can be undone, but it changes the name every record shows, so it's
confirmed too.
-
Call the tool without
confirmation_token. Nothing changes. The result looks like this:{"status": "confirmation_required","message": "Nothing has changed yet. Show this preview to the user. If they agree, call the tool again with identical arguments and this confirmation_token.","preview": { "canApply": true, "lines": ["…"], "readyToAssignBefore": {"minor": 120000, "display": "$1,200.00"}, "readyToAssignAfter": {"minor": 45000, "display": "$450.00"} },"confirmation_token": "…","expires_in_seconds": 600}For
assign_budget,previewis the result of thepreview-fundingoperation. CheckcanApplyandissues: a preview can show that the change would fail, for example because there isn't enough money ready to assign. Formerge_payees,previewis the result of thepreview-merge-payeesoperation: the destination and source payees by name, and how many records of each kind would move. Tell the user these names, not ones the model found earlier. A merge that would fail, for example because a payee was already merged, fails at this step and no token is issued. Forrename_payee,previewis the result of thepreview-rename-payeeoperation: the payee's current and new names, how many records use it, and any other payee that already has the new name. A rename never combines payees, so if that list isn't empty, tell the user and offermerge_payeesinstead. For the transaction bulk tools,previewlists every selected transaction as it is now, in request order, withtargetnaming what would be set (category, payee, account, cleared state or the tags to add and remove). The preview runs the edit's own checks inside a transaction that is rolled back, so an edit that would be refused, such as moving a transfer or a reconciled transaction to another account, fails at this step and no token is issued. Forbulk_approve_inbox_items,previewreports astatusper item (would_create,would_match,stale,needs_review,already_approvedornot_actionable) with the payee and category it would get. Forapply_payee_to_matching_inbox_items, it lists the inbox items that would get the payee in the request, with the bank's text and the payee now staged on each. Fordelete_category_target,previewis the category's current target. Forcreate_recurring_transaction,previewrepeats the arguments and addsoccurrencesPostedNow, how many transactions confirming posts immediately (every occurrence fromanchorDatethrough today; absent when the call copies asourceTransactionIdor has noanchorDate). Tell the user that count, and notecatchUpThroughDateis not accepted. Fordelete_recurring_transaction,previewis the series as it is now (fromget-recurring-transaction). Deleting only deactivates the series and can't be switched on again; existing transactions stay.delete_payee_aliasandremove_debt_plan_memberhave no preview operation, so theirpreviewonly repeats the arguments: tell the user what the ID stands for from what you read earlier. -
Show the preview to the user. Only if they agree, call again with identical arguments plus that
confirmation_token. Keep the sameidempotency_key.
The token is signed. It is bound to the user, the access token, the tool and the
exact arguments, and it expires after 10 minutes. A changed argument, an
expired token or a token from another connection returns
confirmation_invalid. Call again without confirmation_token to get a fresh
preview.
The token comes back to the model, so it shows that the same arguments were
sent twice, not that a person agreed. A person agrees through the AI client's
own approval prompt. That is why a merge, which can't be undone, is also
limited to 20 payees per call, and why every tool that can't be undone is marked destructiveHint; see
What no tool can do. The same
reasoning caps the bulk tools below what the REST operations accept: a call
changes at most 100 transactions (the REST operations take 500) or approves at
most 50 inbox items (REST takes 200). A call over the cap is refused with
invalid_arguments before any preview, and nothing changes.
Preview operations
The bulk tools' previews are read-only REST operations of their own. They take the same request body as the edit they preview and change nothing, so you can also call them directly.
| Operation | Path | Previews |
|---|---|---|
preview-bulk-set-transaction-category | POST /v1/workspaces/{workspaceID}/transactions/bulk/category/preview | bulk-set-transaction-category |
preview-bulk-set-transaction-payee | POST …/transactions/bulk/payee/preview | bulk-set-transaction-payee |
preview-bulk-set-transaction-account | POST …/transactions/bulk/account/preview | bulk-set-transaction-account |
preview-bulk-set-transaction-cleared | POST …/transactions/bulk/cleared/preview | bulk-set-transaction-cleared |
preview-bulk-update-transaction-tags | POST …/transactions/bulk/tags/preview | bulk-update-transaction-tags |
preview-bulk-resolve-bank-sync-inbox | POST …/bank-sync/inbox/bulk-resolve/preview | bulk-resolve-bank-sync-inbox |
preview-apply-bank-sync-payee-to-matching | POST …/bank-sync/inbox/{importedTransactionID}/apply-payee-to-matching/preview | apply-bank-sync-payee-to-matching |
The five transaction previews return the selected transactions as they are now
(transactions, in request order, with the names of their categories and tags)
and target, the names of what the edit would set. They run the edit inside a
database transaction that is always rolled back, so a request the edit would
refuse is refused with the same error. Moving a transfer or a reconciled
transaction to another account, a category, payee, account or tag that doesn't
exist, and an unknown transaction all fail here.
All seven previews need their write scope and the matching read scope,
because they return data: transactions:write and transactions:read for the
transaction previews, bank-sync:write and bank-sync:read for the inbox
previews. A token that may only write can't read through them. They are exempt
from the read-only mode of a workspace over its plan limits. preview-bulk-resolve-bank-sync-inbox reports, per item,
would_create, would_match, stale, needs_review, already_approved or
not_actionable, using the same fingerprint check as the approval.
preview-apply-bank-sync-payee-to-matching lists the items that would get the
payee in the request. Unlike count-bank-sync-payee-matches, which counts for
the payee already staged on the item, it uses the payee you send.
For the business tools, the preview is the record itself, read with the
matching get_ operation (for issue_invoice, the draft with its lines, total
and client; its number stays empty until the invoice is issued). The tools
that always need confirmation are issue_invoice, void_invoice,
mark_quote_sent, accept_quote, decline_quote, archive_client,
archive_project, delete_invoice, delete_invoice_line, delete_quote,
delete_quote_line, delete_time_entry and delete_project_task. Applying a
rule to existing transactions (apply_transaction_rule_to_existing_transactions)
also always needs confirmation; its preview is the dry run of that rule, and the
token binds the rule and every filter, so changing any of them needs a new preview.
assign_budget with a single allocation, and every other write tool, runs
straight away. Your AI client may still ask the user before running any write
tool, based on the tool's annotations.