[
  {
    "id": "accounting_accounts",
    "tier": "read",
    "description": "The connected accounting system's chart of accounts, for mapping categories."
  },
  {
    "id": "accounting_export",
    "tier": "destructive",
    "description": "Pushes selected transactions (with attachments) to the connected accounting system (QuickBooks, Xero, Fortnox)."
  },
  {
    "id": "accounting_sync_status",
    "tier": "read",
    "description": "Whether transactions were exported to the connected accounting system, and when: filter by transaction ids or provider."
  },
  {
    "id": "apps_create_platform_link",
    "tier": "connections",
    "description": "Creates a one-time code to link a chat platform (e.g. WhatsApp, Telegram) to the team's SuperBooks assistant."
  },
  {
    "id": "apps_update",
    "tier": "write",
    "description": "Updates an installed app's configuration."
  },
  {
    "id": "apps_update_settings",
    "tier": "write",
    "description": "Changes an installed app's settings (e.g. which Slack channel receives notifications)."
  },
  {
    "id": "bank_accounts_balances",
    "tier": "read",
    "description": "Current balance per bank account."
  },
  {
    "id": "bank_accounts_create",
    "tier": "write",
    "description": "Creates a manual bank account (for imports or cash)."
  },
  {
    "id": "bank_accounts_currencies",
    "tier": "read",
    "description": "Currencies used by the team's bank accounts."
  },
  {
    "id": "bank_accounts_delete",
    "tier": "destructive",
    "description": "Deletes a bank account and its transactions."
  },
  {
    "id": "bank_accounts_list",
    "tier": "read",
    "description": "List bank accounts for the current team with the connected institution's name + logo when available. Use this to discover bank account ids before listing transactions, attaching payment info to an invoice, etc. Supports filter by `enabled` (active accounts only) and `manual` (user-created vs. provider-synced). Does NOT include full IBAN / account numbers; over MCP, call bank_accounts_reveal_details with the account id when the user asks for them."
  },
  {
    "id": "bank_accounts_payment_info",
    "tier": "read",
    "description": "Bank accounts that have payment details to print on invoices."
  },
  {
    "id": "bank_accounts_reveal_details",
    "tier": "read",
    "description": "Reveals one bank account's full IBAN, account number, routing/wire numbers, BIC and sort code (decrypted). Only call when the user asks for these numbers, and show them only to the user."
  },
  {
    "id": "bank_accounts_transaction_count",
    "tier": "read",
    "description": "How many transactions a bank account has."
  },
  {
    "id": "bank_accounts_update",
    "tier": "write",
    "description": "Renames a bank account, sets its type or balance, or turns syncing on/off."
  },
  {
    "id": "bank_connections_add_accounts",
    "tier": "connections",
    "description": "Adds more accounts from an existing bank connection."
  },
  {
    "id": "bank_connections_limit",
    "tier": "read",
    "description": "How many bank connections the plan allows and how many are used."
  },
  {
    "id": "bank_connections_syncing",
    "tier": "read",
    "description": "Bank connections that are connecting or syncing right now."
  },
  {
    "id": "bank_provider_accounts",
    "tier": "read",
    "description": "Accounts a bank connection exposes, before choosing which to add."
  },
  {
    "id": "billing_status",
    "tier": "read",
    "description": "The team's SuperBooks plan and subscription: plan, status, renewal or expiry date, store, billing cycle, recent payments, and which plans can be bought."
  },
  {
    "id": "categories_create",
    "tier": "write",
    "description": "Create a new transaction category for the current team. Name is required; all other fields are optional. The slug is derived from the name (lowercase, letters and numbers of any language kept, everything else -> underscore, capped at 64 chars) and is the same slug the app builds, so a name with no letter or number is refused. Slugs must be unique per team — creating a category with a name that slugifies to an existing slug will throw a unique-constraint error. To nest under a parent, pass parent_id (the UUID id of an existing category). Returns the created row."
  },
  {
    "id": "categories_delete",
    "tier": "destructive",
    "description": "Permanently delete a transaction category. DESTRUCTIVE. REFUSES if the category is a system category (system: true). REFUSES if any transactions still reference the category (by slug) — re-categorize or delete those transactions first, then retry. Side-effects on success: any saved enrichment rules that reference this category are also deleted. Child categories are NOT auto-deleted and will keep pointing at the removed parent — re-nest or delete the children first if that matters. Returns deleted: false if the category was not found OR was refused; an error is thrown for refusals so the caller can distinguish. Confirm with the user before calling."
  },
  {
    "id": "categories_get",
    "tier": "read",
    "description": "One transaction category by id, with tax settings."
  },
  {
    "id": "categories_list",
    "tier": "read",
    "description": "List all transaction categories for the current team. Returns a FLAT array (not hierarchical) — each row includes parent_id so the caller can reconstruct the parent/child tree if needed. System categories (system: true) are included; they cannot be updated or deleted. Ordered by system DESC, name ASC. No pagination — the full category catalog is typically small."
  },
  {
    "id": "categories_update",
    "tier": "write",
    "description": "Update one transaction category. Only the fields you pass are modified; omit a field to leave it untouched. REFUSES to update a system category (system: true). REFUSES to change parent_id on a category that has children — re-nest the children first. The slug is NOT updatable (it is part of the composite primary key); to rename, create a new category and migrate transactions. Returns updated: true on success."
  },
  {
    "id": "chat_messages",
    "tier": "read",
    "description": "Messages of one past in-app assistant conversation."
  },
  {
    "id": "chat_threads",
    "tier": "read",
    "description": "The user's past conversations with the in-app SuperBooks assistant."
  },
  {
    "id": "connected_apps_authorized",
    "tier": "read",
    "description": "Apps (Claude, ChatGPT, Zapier…) the user has authorized to use SuperBooks."
  },
  {
    "id": "connected_apps_disconnect",
    "tier": "keys",
    "description": "Disconnects an app from the team."
  },
  {
    "id": "connected_apps_list",
    "tier": "read",
    "description": "Connected apps for the team with what each may do and when it was last used."
  },
  {
    "id": "connected_apps_revoke",
    "tier": "keys",
    "description": "Revokes one app's access to SuperBooks."
  },
  {
    "id": "create_api_key",
    "tier": "keys",
    "description": "Creates a team API key with the given permission tiers and returns the key once; it cannot be shown again. The tiers cannot exceed this connection's own (see list_granted_scopes)."
  },
  {
    "id": "create_support_ticket",
    "tier": "support",
    "description": "Sends a message to SuperBooks support on the user's behalf: a problem, a feature request, a question or anything else. Support replies to the user by email. Say what the user tried and what happened. Shares the support form's limit of 5 messages an hour."
  },
  {
    "id": "create_team",
    "tier": "team",
    "description": "Creates a new SuperBooks team owned by the signed-in user. The app keeps opening on the current team; use update_profile.defaultTeamId to switch."
  },
  {
    "id": "create_upload_url",
    "tier": "write",
    "description": "A short-lived URL to PUT a file into the team's SuperBooks storage: a bank CSV for transactions_import, a receipt for transaction_attachments_create or inbox_create, a document for the vault. PUT the bytes with the returned headers, then pass filePath to that tool. Needs a client that can make HTTP requests."
  },
  {
    "id": "customers_cancel_enrichment",
    "tier": "write",
    "description": "Stops a running enrichment."
  },
  {
    "id": "customers_clear_enrichment",
    "tier": "write",
    "description": "Removes enriched details from a customer."
  },
  {
    "id": "customers_create",
    "tier": "write",
    "description": "Create a new customer for the current team. Name and email are required; billing/shipping address fields and tags are optional. To assign tags, pass an array of existing tag ids (use tags_list/tags_create from the tags domain to manage them — this tool does NOT create new tags)."
  },
  {
    "id": "customers_delete",
    "tier": "destructive",
    "description": "Permanently delete a customer. DESTRUCTIVE: also permanently deletes all tracker projects belonging to this customer, and unlinks the customer from invoices and recurring-invoice schedules (those financial records are kept, but lose their customer link). Confirm with the user explicitly. Prefer customers_update with is_archived=true unless the customer must be removed for compliance reasons. Returns deleted: false if the customer was already absent — does not throw."
  },
  {
    "id": "customers_enrich",
    "tier": "write",
    "description": "Looks up a customer's company details (website, industry, address) from public sources."
  },
  {
    "id": "customers_get",
    "tier": "read",
    "description": "Fetch one customer by ID with full billing/shipping details, tags, and invoice/project counts. Returns null if not found for the current team."
  },
  {
    "id": "customers_invoice_summary",
    "tier": "read",
    "description": "A customer's invoiced, paid and outstanding totals."
  },
  {
    "id": "customers_list",
    "tier": "read",
    "description": "List customers for the current team, newest first. Supports cursor pagination plus filters by name (partial, case-insensitive), email (partial, case-insensitive), tag id, and archived state. Pass the returned nextCursor to fetch the next page."
  },
  {
    "id": "customers_toggle_portal",
    "tier": "write",
    "description": "Turns a customer's self-service invoice portal on or off."
  },
  {
    "id": "customers_update",
    "tier": "write",
    "description": "Update one customer. Only the fields you pass are modified — other fields are left untouched. Set is_archived=true to archive (recommended over customers_delete for soft removal). If tag_ids is provided, it FULLY REPLACES the existing tag set: tags not in the array are unlinked. Omit tag_ids entirely to leave tags untouched."
  },
  {
    "id": "delete_account",
    "tier": "account",
    "description": "Permanently deletes the signed-in user's SuperBooks account, with every team only they belong to. Asks for a confirmToken first. Refused while the user is the only owner of a team other people use; make someone else owner or delete that team first. When the result's storeNotice is set, a subscription billed by the App Store or Google Play is still active: tell the user to cancel it in that store."
  },
  {
    "id": "delete_team",
    "tier": "team",
    "description": "Permanently deletes the team and all of its data. Owner only. Asks for a confirmToken first."
  },
  {
    "id": "disconnect",
    "tier": "connections",
    "description": "Disconnects a bank, mailbox, app or Stripe invoice payments from the team; syncing from it stops. Asks for a confirmToken first."
  },
  {
    "id": "disconnect_sign_in_method",
    "tier": "account",
    "description": "Removes one way the signed-in user signs in to SuperBooks: a provider from list_sign_in_methods. Asks for a confirmToken first. Refused for the account's last way in. Answers the sign-in methods that are left."
  },
  {
    "id": "document_tags_assign",
    "tier": "write",
    "description": "Tags a document."
  },
  {
    "id": "document_tags_create",
    "tier": "write",
    "description": "Creates a document tag."
  },
  {
    "id": "document_tags_delete",
    "tier": "destructive",
    "description": "Deletes a document tag."
  },
  {
    "id": "document_tags_list",
    "tier": "read",
    "description": "Document tags."
  },
  {
    "id": "document_tags_unassign",
    "tier": "write",
    "description": "Removes a tag from a document."
  },
  {
    "id": "documents_check_attachments",
    "tier": "read",
    "description": "Which of the given files are already stored as documents."
  },
  {
    "id": "documents_create_upload_url",
    "tier": "write",
    "description": "Step 1 of 2 for storing a receipt, invoice or other document file, and the recommended way to upload one: every step is checked on the server and safe to repeat. Registers the file and returns a short-lived `upload_url`: send the file bytes to it with an HTTP PUT whose `Content-Type` header is exactly the returned `upload_headers` value (the bytes go straight to storage, not through this API), then call `documents_finalize_upload` with the returned `upload_id` to check the file and start processing. Accepts PDF, PNG, JPEG, WebP and HEIC/HEIF files up to 5,000,000 bytes. `destination` 'inbox' (default) puts the file in the Inbox, where it is processed and suggested as a match for bank transactions, and counts against the plan's monthly inbox limit; 'vault' stores it in the document vault, which has no monthly limit and extracts the text. Uploading the same filename twice stores two separate files. Link the stored file to a transaction afterwards with `transactions_attach_document`. Not for files already stored (use `documents_list` or `inbox_list`). A registered upload that is never finalized stays as an unfinished item and can be removed with `inbox_delete` or `documents_delete`."
  },
  {
    "id": "documents_delete",
    "tier": "destructive",
    "description": "Permanently delete a document by id. DESTRUCTIVE. Side-effects: (a) all tag assignments for this document are removed; (b) any transaction attachments that reference this document's stored file are also deleted, so the file stops appearing on those transactions; (c) the underlying stored file is permanently deleted. Returns `deleted: false` if the document was not found for this team — does not throw. Confirm with the user before calling."
  },
  {
    "id": "documents_finalize_upload",
    "tier": "write",
    "description": "Step 2 of 2 for storing a file (the recommended upload flow: one checked, repeatable call after the PUT): call after you have PUT the file to the `upload_url` from `documents_create_upload_url`. Checks that the file arrived, is no larger than 5,000,000 bytes and really is the declared type (judged by its content, not its name), then starts processing it. A file that fails the check is discarded and the upload must be started again. Returns `inbox_id` (destination 'inbox') or `document_id` (destination 'vault'); pass it to `transactions_attach_document` to link the file to a transaction. Safe to call again for the same `upload_id`: a finalized upload returns `already_finalized: true` and is not processed twice. Throws if the upload id is unknown for this team or if the file has not been uploaded yet (PUT it, then call again)."
  },
  {
    "id": "documents_get",
    "tier": "read",
    "description": "Fetch one document by id with the full row including OCR-extracted text (`body`, `content`), title/summary, `tag`, `language`, processing status, and assigned tag IDs. Returns null if not found for the current team."
  },
  {
    "id": "documents_get_download_url",
    "tier": "read",
    "description": "A short-lived download URL for one stored document."
  },
  {
    "id": "documents_get_download_urls",
    "tier": "read",
    "description": "Short-lived download URLs for several stored documents."
  },
  {
    "id": "documents_list",
    "tier": "read",
    "description": "List documents (uploaded files in the vault) for the current team, newest first. Excludes folder placeholders (`*.folderPlaceholder`). Supports filter by tag IDs, date range, and a free-text query `q` (case-insensitive substring match on name only). For phrase, fuzzy, or typo-tolerant text search, use `documents_search`. Cursor pagination: pass the `cursor` from the previous page to get the next one."
  },
  {
    "id": "documents_process",
    "tier": "write",
    "description": "Runs extraction (OCR, amounts, dates) on uploaded documents."
  },
  {
    "id": "documents_related",
    "tier": "read",
    "description": "Documents related to a document (same vendor, amount or period)."
  },
  {
    "id": "documents_reprocess",
    "tier": "write",
    "description": "Re-runs extraction on one document."
  },
  {
    "id": "documents_search",
    "tier": "read",
    "description": "Full-text search documents by phrase, with substring and typo-tolerant matching on the document name. Use this (not `documents_list`) when the user asks to find documents by phrase, invoice number, vendor name, etc. — it handles typos and partial matches. Returns one page of results newest first by `created_at`; pass the returned `cursor` to fetch more."
  },
  {
    "id": "export_data",
    "tier": "account",
    "description": "Exports the team's transactions, invoices and customers as CSV files. Team owners only; at most 3 exports an hour. The first call starts the export and returns a jobId. Call again with that jobId to get one download link per file; each link works once, for 15 minutes, while signed in."
  },
  {
    "id": "get_connect_links",
    "tier": "connections",
    "description": "One-time links that start connecting a bank (plaid, teller, gocardless, enablebanking), a mailbox for receipt import (inbox:gmail, inbox:outlook), an app (quickbooks, xero, fortnox, slack, gmail, outlook, stripe) or Stripe invoice payments (stripe-payments). The user opens the link while signed in to SuperBooks, signs in at the provider and comes back. Without provider, returns one link per provider. Each link works once, for 15 minutes."
  },
  {
    "id": "get_notification_prefs",
    "tier": "read",
    "description": "The signed-in user's notification preferences in a team: every notification type, each channel it can use (in_app, email, push) and whether it is on."
  },
  {
    "id": "get_profile",
    "tier": "read",
    "description": "The signed-in user's SuperBooks profile (name, email, avatar, locale, timezone, date and time format, default team), whether they can sign in with email and password, and the team invites waiting for them."
  },
  {
    "id": "inbox_blocklist_add",
    "tier": "write",
    "description": "Stops importing email from a sender or domain."
  },
  {
    "id": "inbox_blocklist_list",
    "tier": "read",
    "description": "Senders and domains whose emails are not imported into the inbox."
  },
  {
    "id": "inbox_blocklist_remove",
    "tier": "write",
    "description": "Resumes importing email from a blocked sender or domain."
  },
  {
    "id": "inbox_by_status",
    "tier": "read",
    "description": "Inbox items with a given status (pending, suggested match, done)."
  },
  {
    "id": "inbox_check_attachments",
    "tier": "read",
    "description": "Which of the given files are already in the inbox."
  },
  {
    "id": "inbox_confirm_match",
    "tier": "write",
    "description": "Accepts the suggested transaction match for an inbox item."
  },
  {
    "id": "inbox_create",
    "tier": "write",
    "description": "Adds an uploaded file (from create_upload_url) to the inbox."
  },
  {
    "id": "inbox_decline_match",
    "tier": "write",
    "description": "Rejects the suggested transaction match for an inbox item."
  },
  {
    "id": "inbox_delete",
    "tier": "destructive",
    "description": "SOFT-DELETE an inbox item — sets `status='deleted'` and clears its `transaction_id` / `attachment_id`; the item itself is retained, not removed. DESTRUCTIVE because it irreversibly: (a) detaches the item from its linked transaction, deleting that attachment; (b) RESETS the linked transaction's `tax_rate` and `tax_type` to NULL if that was its only attachment; (c) discards any pending match suggestions for this inbox item. The uploaded file itself is retained. Returns `deleted: false` if the inbox item was not found for this team — does not throw. Confirm with the user before calling."
  },
  {
    "id": "inbox_delete_many",
    "tier": "destructive",
    "description": "Deletes several inbox items."
  },
  {
    "id": "inbox_get",
    "tier": "read",
    "description": "One inbox item (receipt/invoice) with its extracted fields and suggested match."
  },
  {
    "id": "inbox_list",
    "tier": "read",
    "description": "List the current team's inbox items (receipts and invoices in its Inbox), newest first. EXCLUDES soft-deleted items (`status='deleted'`) and grouped follow-ups, so each primary item appears once. Filter by exact status and/or a free-text query `q` (matches `display_name` / `file_name` / `description`; numeric `q` also matches `amount` within +/- 10% tolerance). Cursor pagination: pass the `cursor` from the previous page to get the next one."
  },
  {
    "id": "inbox_match",
    "tier": "write",
    "description": "Link an inbox item (receipt / invoice) to a bank transaction. NOT a simple flag flip — this: (a) attaches each grouped sibling to the same transaction; (b) copies `tax_amount` / `tax_rate+tax_type` from the inbox item onto the transaction (only if the inbox has them; when the item and the transaction are in different currencies the tax amount is scaled into the transaction's currency by transaction amount / item total, and when it cannot be stated that way (no total, a zero total, no currency, or a tax larger than the total) the transaction's tax_amount is cleared); (c) sets each linked inbox item's `status='done'` and stores its `attachment_id` + `transaction_id`. IDEMPOTENT when the item is already matched to the SAME transaction. Throws if the item is already matched to a DIFFERENT transaction, if any grouped sibling is matched to a different txn, or if the target transaction does not exist for this team."
  },
  {
    "id": "inbox_process_attachments",
    "tier": "write",
    "description": "Runs extraction on uploaded inbox files."
  },
  {
    "id": "inbox_retry_matching",
    "tier": "write",
    "description": "Re-runs transaction matching for an inbox item."
  },
  {
    "id": "inbox_search",
    "tier": "read",
    "description": "Searches inbox items by text, amount or date."
  },
  {
    "id": "inbox_unmatch",
    "tier": "write",
    "description": "Removes the link between an inbox item and its transaction."
  },
  {
    "id": "inbox_update",
    "tier": "write",
    "description": "Edits an inbox item's extracted fields or status."
  },
  {
    "id": "institutions_countries",
    "tier": "read",
    "description": "Countries where bank connections are available."
  },
  {
    "id": "institutions_get",
    "tier": "read",
    "description": "One bank institution by id."
  },
  {
    "id": "institutions_provider_countries",
    "tier": "read",
    "description": "Countries where one bank provider (plaid, gocardless, teller or enablebanking) has banks to connect."
  },
  {
    "id": "institutions_search",
    "tier": "read",
    "description": "Banks available to connect in a country, with the provider that serves each; use with get_connect_links."
  },
  {
    "id": "invite_member",
    "tier": "team",
    "description": "Invites people to the team by email; SuperBooks emails each one an invitation link. Owner only."
  },
  {
    "id": "invoice_payments_refund",
    "tier": "destructive",
    "description": "Refunds a customer's Stripe payment on an invoice."
  },
  {
    "id": "invoice_products_create",
    "tier": "write",
    "description": "Saves a new product/service for reuse on invoice lines."
  },
  {
    "id": "invoice_products_delete",
    "tier": "destructive",
    "description": "Deletes a saved product."
  },
  {
    "id": "invoice_products_get",
    "tier": "read",
    "description": "One saved invoice product by id."
  },
  {
    "id": "invoice_products_increment_usage",
    "tier": "write",
    "description": "Counts one more use of a saved product (keeps the most-used list ordered)."
  },
  {
    "id": "invoice_products_list",
    "tier": "read",
    "description": "Saved invoice products/services with name, price, unit and usage count."
  },
  {
    "id": "invoice_products_save_line",
    "tier": "write",
    "description": "Saves an invoice line as a reusable product."
  },
  {
    "id": "invoice_products_update",
    "tier": "write",
    "description": "Updates a saved product's name, price, unit or description."
  },
  {
    "id": "invoice_products_upsert",
    "tier": "write",
    "description": "Creates or updates a saved product by id."
  },
  {
    "id": "invoice_templates_count",
    "tier": "read",
    "description": "How many invoice templates the team has."
  },
  {
    "id": "invoice_templates_create",
    "tier": "write",
    "description": "Creates an invoice template."
  },
  {
    "id": "invoice_templates_delete",
    "tier": "destructive",
    "description": "Deletes an invoice template."
  },
  {
    "id": "invoice_templates_get",
    "tier": "read",
    "description": "One invoice template, or the default when no id is given."
  },
  {
    "id": "invoice_templates_list",
    "tier": "read",
    "description": "Invoice templates (layout, logo, payment details, default notes)."
  },
  {
    "id": "invoice_templates_set_default",
    "tier": "write",
    "description": "Makes a template the default for new invoices."
  },
  {
    "id": "invoice_templates_upsert",
    "tier": "write",
    "description": "Creates or updates an invoice template."
  },
  {
    "id": "invoices_average_days_to_payment",
    "tier": "read",
    "description": "Average days between issue and payment."
  },
  {
    "id": "invoices_average_size",
    "tier": "read",
    "description": "Average invoice amount in the period."
  },
  {
    "id": "invoices_cancel_schedule",
    "tier": "write",
    "description": "Cancels a scheduled send and returns the invoice to draft."
  },
  {
    "id": "invoices_create",
    "tier": "write",
    "description": "Finalises an invoice (create, scheduled or send) from a draft id with delivery options."
  },
  {
    "id": "invoices_create_draft",
    "tier": "write",
    "description": "Create a draft invoice. Draft is not sent to the customer; user reviews and calls invoices_send to deliver. Optionally adds sales tax (tax_rate, e.g. 13 for Ontario HST), a VAT line, per-line tax rates and a discount: subtotal, tax and total are computed exactly as the invoice editor and the PDF compute them, and returned. Optionally takes the invoice_number to use, e.g. when recording an invoice that was issued earlier; leave it out to get the next number in the team's sequence. To record an invoice that is already paid, create it here, then call invoices_mark_paid."
  },
  {
    "id": "invoices_create_from_tracker",
    "tier": "write",
    "description": "Drafts an invoice from a tracker project's billable hours for a date range."
  },
  {
    "id": "invoices_default_settings",
    "tier": "read",
    "description": "Defaults for a new invoice: next number, currency, template, payment terms."
  },
  {
    "id": "invoices_delete",
    "tier": "destructive",
    "description": "Deletes an invoice."
  },
  {
    "id": "invoices_download_link",
    "tier": "read",
    "description": "A one-time link that downloads an invoice, or its receipt, as a PDF. Give the link to the user; it opens in their signed-in browser."
  },
  {
    "id": "invoices_duplicate",
    "tier": "write",
    "description": "Copies an invoice into a new draft."
  },
  {
    "id": "invoices_get",
    "tier": "read",
    "description": "Fetch one invoice with line items, customer, and totals."
  },
  {
    "id": "invoices_inactive_clients_count",
    "tier": "read",
    "description": "How many customers have not been invoiced recently."
  },
  {
    "id": "invoices_list",
    "tier": "read",
    "description": "List invoices for the current team, ordered by created_at desc (newest first). Supports cursor pagination plus filters by status (one or several), date range (issue_date), and customer. Pass the returned nextCursor to fetch the next page. `totals` sums EVERY invoice matching the filters (not just this page), per status and currency, so use it for counts and amounts instead of adding up pages. Statuses: `unpaid` and `overdue` were sent and are money customers still owe (an overdue invoice is NOT also unpaid, so include both); `draft` and `scheduled` have not been sent, so the customer owes nothing yet. For 'outstanding' or 'who owes me' questions, pass statuses [unpaid, overdue, draft, scheduled] and report the amount owed separately from unsent drafts."
  },
  {
    "id": "invoices_mark_paid",
    "tier": "write",
    "description": "Mark an invoice as paid on a given day. Never emails the customer or anyone else; it only records the payment and adds a 'paid' entry to the team's activity feed. Works on an unpaid or overdue invoice. A DRAFT is issued and marked paid in one step, still without emailing anyone, for recording an invoice that was sent outside SuperBooks (it counts as issued, with no sent date). Calling it again on a paid invoice changes nothing, or corrects the paid date when paid_at is given. Refuses a scheduled, canceled or refunded invoice. To undo, use invoices_mark_unpaid."
  },
  {
    "id": "invoices_mark_unpaid",
    "tier": "write",
    "description": "Undo 'paid' on an invoice: the invoice goes back to unpaid and its paid date is cleared. Never emails anyone. Also reopens a canceled (voided) invoice as unpaid. Use it to correct an invoice marked paid by mistake, or before invoices_void on a paid invoice. An invoice that is already unpaid or overdue is returned unchanged. Refuses a draft, a scheduled invoice and a refunded invoice (a refund cannot be undone)."
  },
  {
    "id": "invoices_most_active_client",
    "tier": "read",
    "description": "The customer with the most invoices in the period."
  },
  {
    "id": "invoices_new_customers_count",
    "tier": "read",
    "description": "Customers invoiced for the first time in the period."
  },
  {
    "id": "invoices_payment_status",
    "tier": "read",
    "description": "Paid, overdue and outstanding totals for the team's invoices."
  },
  {
    "id": "invoices_remind",
    "tier": "destructive",
    "description": "Emails the customer a payment reminder for an invoice."
  },
  {
    "id": "invoices_search_number",
    "tier": "read",
    "description": "Checks whether an invoice number is already used."
  },
  {
    "id": "invoices_send",
    "tier": "write",
    "description": "Send a draft invoice to its customer: marks it sent (status draft -> unpaid; the schema has no 'sent' status) and queues the customer email. Sending an invoice that was already sent returns it with already_sent: true and does not email the customer again. Throws if the invoice is not found, is canceled or paid, or the email could not be queued (the invoice then stays a draft)."
  },
  {
    "id": "invoices_summary",
    "tier": "read",
    "description": "Invoice totals by status, optionally filtered by status."
  },
  {
    "id": "invoices_update",
    "tier": "write",
    "description": "Updates an invoice's fields (status, dates, notes, payment details)."
  },
  {
    "id": "invoices_update_schedule",
    "tier": "write",
    "description": "Changes when a scheduled invoice will be sent."
  },
  {
    "id": "invoices_void",
    "tier": "destructive",
    "description": "Void an invoice (soft-cancel that preserves audit trail). Status becomes 'canceled' (the schema does not have a 'voided' status; canceled is the closest soft-cancel). Destructive — confirm with the user before calling. Only an unpaid, overdue or scheduled invoice can be voided: a paid invoice must be marked unpaid first (invoices_mark_unpaid), a refunded invoice can never be voided, and a draft is deleted rather than voided. Throws if the invoice is not found, is already canceled (so re-voiding never silently succeeds), or is in a status that cannot be voided."
  },
  {
    "id": "jobs_get_status",
    "tier": "read",
    "description": "A background job's status and result (poll after exports, imports, syncs)."
  },
  {
    "id": "jobs_status",
    "tier": "read",
    "description": "A background job's full run record."
  },
  {
    "id": "jobs_trigger",
    "tier": "write",
    "description": "Starts an allowed background job (sync, reprocess, export) for the team."
  },
  {
    "id": "leave_team",
    "tier": "team",
    "description": "The signed-in user leaves the team. Refused for the last owner. Asks for a confirmToken first."
  },
  {
    "id": "list_api_keys",
    "tier": "read",
    "description": "The team's API keys: id, name, permission tiers, who created it, created and last used dates. Never the key itself."
  },
  {
    "id": "list_connections",
    "tier": "read",
    "description": "Everything connected to the team: banks, mailboxes that import receipts (inbox:gmail, inbox:outlook), apps (QuickBooks, Xero, Fortnox, Slack, Gmail, Outlook, Stripe, Telegram, WhatsApp) and Stripe invoice payments, each with its status and last error."
  },
  {
    "id": "list_granted_scopes",
    "tier": "read",
    "description": "What this connection may do: its permission tiers, the tiers it lacks, its raw scopes and which client it is."
  },
  {
    "id": "list_invites",
    "tier": "read",
    "description": "Pending invitations: sent are the ones this team sent; received are the ones the signed-in user got from any team."
  },
  {
    "id": "list_members",
    "tier": "read",
    "description": "Members of the team with their user id, name, email and role."
  },
  {
    "id": "list_plans",
    "tier": "read",
    "description": "SuperBooks plans with their ids, USD list prices, billing intervals and features. Use an id from here for upgrade_plan."
  },
  {
    "id": "list_sign_in_methods",
    "tier": "read",
    "description": "Every way the signed-in user can sign in to SuperBooks (Google, Apple, email and password), whether each one can be disconnected (never the last one) and why not, the methods not connected yet, and how to add one."
  },
  {
    "id": "list_support_tickets",
    "tier": "read",
    "description": "The signed-in user's recent messages to SuperBooks support, newest first, from the support form and from create_support_ticket."
  },
  {
    "id": "list_teams",
    "tier": "read",
    "description": "List the teams this connection can work in: each team's id, name, and your role in it. When it lists more than one team, pass the chosen team's id as the teamId argument of every other tool. No arguments."
  },
  {
    "id": "manage_subscription",
    "tier": "billing",
    "description": "Changes the team's subscription. cancel (at the end of the paid period) and refund (the last payment) ask for a confirmToken first. resume restarts a cancelled one. portal returns a one-time link to the billing portal. App Store and Google Play subscriptions get a link to the store's page instead. extend is done by SuperBooks support and points at create_support_ticket."
  },
  {
    "id": "notifications_list",
    "tier": "read",
    "description": "The user's in-app notifications."
  },
  {
    "id": "notifications_mark",
    "tier": "write",
    "description": "Marks one notification read or archived."
  },
  {
    "id": "notifications_mark_all",
    "tier": "write",
    "description": "Marks every notification read or archived."
  },
  {
    "id": "oauth_apps_create",
    "tier": "keys",
    "description": "Registers an OAuth application (name, redirect URIs, scopes); returns its client id and secret once."
  },
  {
    "id": "oauth_apps_delete",
    "tier": "destructive",
    "description": "Deletes a registered OAuth application and every grant it holds."
  },
  {
    "id": "oauth_apps_get",
    "tier": "read",
    "description": "One registered OAuth application (never its secret)."
  },
  {
    "id": "oauth_apps_list",
    "tier": "read",
    "description": "OAuth applications the team has registered (developer apps)."
  },
  {
    "id": "oauth_apps_regenerate_secret",
    "tier": "keys",
    "description": "Issues a new client secret; the old one stops working."
  },
  {
    "id": "oauth_apps_set_approval",
    "tier": "keys",
    "description": "Sets a registered application's listing status (draft, pending, approved, rejected)."
  },
  {
    "id": "oauth_apps_update",
    "tier": "keys",
    "description": "Changes a registered OAuth application's name, logo, redirect URIs or scopes."
  },
  {
    "id": "overview_summary",
    "tier": "read",
    "description": "The dashboard summary: cash, revenue, expenses, open invoices, items needing attention."
  },
  {
    "id": "recurring_invoices_create",
    "tier": "write",
    "description": "Creates a recurring invoice schedule (frequency, start date, customer, template invoice)."
  },
  {
    "id": "recurring_invoices_delete",
    "tier": "destructive",
    "description": "Deletes a recurring invoice schedule."
  },
  {
    "id": "recurring_invoices_get",
    "tier": "read",
    "description": "One recurring invoice schedule by id."
  },
  {
    "id": "recurring_invoices_list",
    "tier": "read",
    "description": "All recurring invoice schedules with next run date and status."
  },
  {
    "id": "recurring_invoices_pause",
    "tier": "write",
    "description": "Pauses a recurring invoice schedule."
  },
  {
    "id": "recurring_invoices_resume",
    "tier": "write",
    "description": "Resumes a paused recurring invoice schedule."
  },
  {
    "id": "recurring_invoices_upcoming",
    "tier": "read",
    "description": "Upcoming invoices a recurring schedule will issue."
  },
  {
    "id": "recurring_invoices_update",
    "tier": "write",
    "description": "Changes a recurring invoice schedule."
  },
  {
    "id": "referral_claim_nudge",
    "tier": "write",
    "description": "Claims the pending referral reward prompt."
  },
  {
    "id": "referral_summary",
    "tier": "read",
    "description": "The user's referral link, sign-ups and earned rewards."
  },
  {
    "id": "referral_ui_state",
    "tier": "read",
    "description": "Which referral prompts the user has dismissed."
  },
  {
    "id": "referral_update_ui_state",
    "tier": "write",
    "description": "Dismisses or restores referral prompts."
  },
  {
    "id": "remove_member",
    "tier": "team",
    "description": "Removes a member from the team. Owner only. Asks for a confirmToken first."
  },
  {
    "id": "reports_balance",
    "tier": "read",
    "description": "Sum of bank account balances grouped by currency for the current team. Returns one entry per distinct currency among ENABLED CASH accounts only (depository and other_asset); credit, loan, other_liability and untyped accounts are excluded, as are disabled / connection-paused accounts. Each entry's `amount` is the raw stored balance — no FX conversion is applied, so callers should not naively add across currencies. Use this when the user asks 'how much cash do I have', 'show my balances', or anything cash-position related. For a single-number runway calculation in the team's base currency, use `reports_runway` instead."
  },
  {
    "id": "reports_burn_rate",
    "tier": "read",
    "description": "Monthly burn (total expenses) for the current team over a date range, expressed in the team's base currency. Each row reports a `YYYY-MM` month label, the burn for that month, the base currency code, and `partial`. Spending is every negative-amount transaction except internal transfers and transactions the user excluded from reports. It is the same burn `reports_runway` uses: an expense in another currency is converted (the transaction's stored base amount, else the stored exchange rate); an expense with no usable rate is left out of the series and listed in `unconverted_burn_currencies` as `[{ currency, transaction_count }]`, in which case say the burn is understated. A month the date range cuts short, or the month still in progress, is returned with `partial: true` and is NOT part of `average`: `average` is the mean of the complete months that had spend (to the cent), and `average_month_count` says how many that is (0 means there is no complete month yet, so say the average is not available). For the last 6 full calendar months, `average` equals `reports_runway`'s `avg_burn`. A window longer than ten years (120 calendar months) is cut to its most recent 120 months, and `window_clamped_from` then says the first day actually read (null otherwise): say the answer covers only that period. Use this when the user asks 'what's my burn', 'how much did I spend per month', or wants a trend chart of expenses."
  },
  {
    "id": "reports_profit_loss",
    "tier": "read",
    "description": "Monthly profit & loss for the current team over a date range — revenue (income transactions, positive amounts), expense (absolute value of negative transactions), and delta (revenue - expense) per `YYYY-MM` month. Also returns aggregate totals across the range. All values are in the team's base currency and are the figures the Reports Revenue, Expenses and Profit cards show, and `definition` states what they count: ALL income, uncategorised income included and the tax inside a payment left in, less all spending. Internal transfers, transactions the user excluded from reports and transactions in categories excluded from reports are not counted. A transaction in another currency is converted (its stored base amount, else the stored exchange rate); one with no usable rate is left out of both sides and listed in `unconverted_currencies` as `[{ currency, transaction_count }]`, in which case say that revenue and expense are understated by what it names and that the profit may be off in either direction. A window longer than ten years (120 calendar months) is cut to its most recent 120 months, and `window_clamped_from` then says the first day actually read (null otherwise): say the answer covers only that period. Use when the user asks 'show my P&L', 'am I profitable', or wants a profit/expense breakdown by month."
  },
  {
    "id": "reports_recurring_expenses",
    "tier": "read",
    "description": "Heuristically detected recurring expenses for the current team. A counterparty (vendor) is flagged when it appears in at least 3 of the last 6 calendar months with negative-amount transactions in the team's base currency. Returns `{ counterparty, months, avg_amount, currency }` per match, sorted by `months` desc then `avg_amount` desc. `months` is the count of distinct months the counterparty appeared in (max 6). NULL counterparties are skipped. Use when the user asks 'what subscriptions am I paying for', 'recurring bills', or wants to audit ongoing vendor spend."
  },
  {
    "id": "reports_revenue",
    "tier": "read",
    "description": "Monthly revenue for the current team over a date range — the income transactions (positive amounts) per `YYYY-MM` month, in the team's base currency. Also returns the grand total. It is the figure the Reports Revenue card shows, and `definition` states what it counts: ALL income, uncategorised income included and the tax inside a payment left in, not only income in the revenue categories (the Revenue Forecast is a separate figure, built on its own basis). Internal transfers, transactions the user excluded from reports and transactions in categories excluded from reports are not revenue. Income in another currency is converted (the transaction's stored base amount, else the stored exchange rate); income with no usable rate is left out and listed in `unconverted_income_currencies` as `[{ currency, transaction_count }]`, in which case say revenue is understated by what it names. A window longer than ten years (120 calendar months) is cut to its most recent 120 months, and `window_clamped_from` then says the first day actually read (null otherwise): say the answer covers only that period. This is cash-in revenue (the bank-ledger view); for invoiced revenue by customer use `reports_top_customers` instead. Use when the user asks 'show revenue', 'how much did I make', or wants a revenue trend chart."
  },
  {
    "id": "reports_revenue_forecast",
    "tier": "read",
    "description": "Projected revenue for the next months: the mean of the last three COMPLETE months that had income (neither the month in progress nor a part-month is in it: the month the twelve-month window opens in unless it opens on the 1st, and the month the team's earliest transaction falls in unless that is the 1st), drawn from the twelve months back from today, in the team's currency unless one is given. Takes no date range. Names the currencies whose income it left out of the history when no exchange rate converts them. `meta.confidenceScore` and each month's `confidence` are a fraction from 0 to 1 (0.85 is 85%) from a back-test of this same projection on the team's own complete months, and are `null` when there are fewer than six whole months of history to back-test."
  },
  {
    "id": "reports_runway",
    "tier": "read",
    "description": "Months of runway based on current cash position (enabled depository and other_asset accounts only; credit, loan and untyped accounts are excluded) and average monthly burn over the last 6 FULL calendar months (the month in progress is not part of it; internal transfers are not spending; only months that had spend are averaged) — all expressed in the team's base currency. Returns `{ months, cash, avg_burn, currency, unconverted_currencies, unconverted_burn_currencies }`. `months` is rounded to one decimal, and is `null` (not Infinity) when `avg_burn` is zero, so downstream JSON renders are safe. It is the same figure the Reports and Overview runway card shows. Cash held in another currency is converted at the stored exchange rate (or the account's stored base balance), so `cash` equals the Balance Sheet's cash line; a cash account with no usable rate is left out of `cash` and listed in `unconverted_currencies` as `[{ currency, account_count }]`, in which case say that `cash` and `months` are understated. Expenses in another currency are converted the same way (the transaction's stored base amount, else the stored exchange rate); an expense with no usable rate is left out of `avg_burn` and listed in `unconverted_burn_currencies` as `[{ currency, transaction_count }]`, in which case say that `avg_burn` is understated and `months` overstated. Use when the user asks 'how long can we last', 'what's my runway', or any survival-time question. For per-currency cash positions use `reports_balance`; for the monthly burn series itself use `reports_burn_rate`."
  },
  {
    "id": "reports_share",
    "tier": "write",
    "description": "Creates a shareable link to a report (type, period, currency)."
  },
  {
    "id": "reports_spending",
    "tier": "read",
    "description": "Spending grouped by transaction category for the current team over a date range, in the team's base currency, sorted by amount descending. It is the same breakdown the Reports Expenses by Category card draws. Spending is every negative-amount transaction except internal transfers and transactions the user excluded from reports (or filed under an excluded category). Spending with no category and the team's own Uncategorized category are one row, `category_slug` `uncategorized`. `total` is the period's spending, the figure the Reports Expenses and Expenses by Category cards state; each row is rounded to the cent, so the rows can differ from `total` by a cent or two in all. An expense in another currency is converted (the transaction's stored base amount, else the stored exchange rate); an expense with no usable rate is left out of the rows and of `total` and listed in `unconverted_currencies` as `[{ currency, transaction_count }]`, in which case say that the total is understated. Use when the user asks 'where is my money going', 'spending by category', or wants a category-level expense breakdown. For a time-series view use `reports_burn_rate`."
  },
  {
    "id": "reports_tax_summary",
    "tier": "read",
    "description": "Sales tax / VAT collected (on income) or paid (on spending) for a period, month by month, in the team currency or `currency`. Tax on a transaction in a currency with no exchange rate is left out and named in `summary.unconvertedCurrencies`: say so when that list is not empty, because the total is then understated."
  },
  {
    "id": "reports_top_customers",
    "tier": "read",
    "description": "Top customers by paid invoice revenue for the current team, sorted descending. Groups by `(customer_id, currency)` so a customer billed in two currencies appears as two rows — currencies are kept separate to avoid silent FX mixing. Only `status = 'paid'` invoices contribute. Date range filters on `paid_at` (cash receipt date); omit both `from` and `to` for all-time totals. `customer_name` is denormalized from the customers table; if the invoice references a deleted customer the name will be null. Use when the user asks 'who are my best customers', 'top revenue contributors', or 'biggest accounts'."
  },
  {
    "id": "request_scopes",
    "tier": "read",
    "description": "Asks the user for more permission tiers for this connection. Returns a one-time link to a page where the user ticks the tiers; the connection keeps working and gets them as soon as they press Allow, with no reconnect. Use the tiers from a SCOPE_MISSING error's next.args, then call the refused tool again."
  },
  {
    "id": "respond_to_invite",
    "tier": "team",
    "description": "Accepts or declines an invitation the signed-in user received."
  },
  {
    "id": "reverify",
    "tier": "connections",
    "description": "Fixes a connection whose sign-in expired or that stopped syncing. A mailbox resyncs right away. A bank or app returns a one-time link where the user signs in again."
  },
  {
    "id": "revoke_api_key",
    "tier": "keys",
    "description": "Revokes an API key; anything using it stops working on its next request. Asks for a confirmToken first."
  },
  {
    "id": "revoke_invite",
    "tier": "team",
    "description": "Cancels a pending invitation the team sent."
  },
  {
    "id": "rotate_api_key",
    "tier": "keys",
    "description": "Replaces an API key with a new one with the same name and tiers, returns the new key once, then revokes the old one. Asks for a confirmToken first."
  },
  {
    "id": "search_global",
    "tier": "read",
    "description": "Cross-entity full-text search over transactions, invoices, customers, documents, and inbox items for the current team. Tokenizes the free-text query into prefix terms combined with AND (`foo bar` matches records containing a word starting with `foo` AND a word starting with `bar`) and ranks results by relevance. Use when the user asks an open-ended 'find anything mentioning X' question; for entity-specific search prefer the per-domain tools (`documents_search`, etc.). Returns an array of `{ id, type, relevance, created_at, data }` rows — `data` carries entity-specific fields for rendering without an extra fetch."
  },
  {
    "id": "short_links_create",
    "tier": "write",
    "description": "Creates a short link for a URL."
  },
  {
    "id": "short_links_create_for_document",
    "tier": "write",
    "description": "Creates a short shareable link to a stored document."
  },
  {
    "id": "tags_create",
    "tier": "write",
    "description": "Create a new tag for the current team. Names are unique per team — creating a tag whose name already exists throws a clear error (the caller should reuse the existing tag id from tags_list). Tags are minimal: only a name is stored (no color, no description). Returns {id, name}."
  },
  {
    "id": "tags_delete",
    "tier": "destructive",
    "description": "Permanently delete a tag. DESTRUCTIVE: also removes this tag from every customer, transaction, and tracker project it is attached to. Those customers, transactions, and tracker projects themselves are NOT affected, only their tag links. There is no soft-delete/archive for tags. Returns {id, deleted: true, name} on success, or {id, deleted: false} if the tag was not found for this team. Confirm with the user before calling."
  },
  {
    "id": "tags_list",
    "tier": "read",
    "description": "List all tags for the current team, ordered by name ascending. Tags are simple {id, name} labels that can be attached to customers, transactions, and tracker projects via their respective tools. No pagination — the tag catalog is typically small."
  },
  {
    "id": "tags_update",
    "tier": "write",
    "description": "Renames a tag."
  },
  {
    "id": "team_get",
    "tier": "read",
    "description": "Get the metadata of the team the call acts on: name, logo, base currency, country, fiscal year start, subscription plan + status, inbox id/email, and Stripe Connect status. Returns null if the team has been deleted underneath the session."
  },
  {
    "id": "tracker_billable_hours",
    "tier": "read",
    "description": "Billable hours and amount per project for a period."
  },
  {
    "id": "tracker_current_timer",
    "tier": "read",
    "description": "The running timer, if any."
  },
  {
    "id": "tracker_delete_entry",
    "tier": "destructive",
    "description": "Permanently delete a tracker time entry. DESTRUCTIVE — confirm with the user before calling. Deleting an entry has no knock-on effects — the projects, customers, and invoices it relates to are left untouched. Returns deleted: false if the entry was already absent — does not throw."
  },
  {
    "id": "tracker_entries_by_date",
    "tier": "read",
    "description": "Time entries on one day."
  },
  {
    "id": "tracker_entries_upsert",
    "tier": "write",
    "description": "Logs or edits a time entry (project, start/stop or duration, description)."
  },
  {
    "id": "tracker_list_entries",
    "tier": "read",
    "description": "List tracker time entries for the current team across a date range, newest first. Default scope is the CURRENT USER's entries — pass `assigned_id: null` to see every teammate. Date range filters the `date` field (the timesheet date) — both `from` and `to` must be provided together (inclusive). Filter by `project_id` to restrict to one project. `duration` is in seconds. Cursor pagination: pass the `cursor` from the previous page to get the next one."
  },
  {
    "id": "tracker_list_projects",
    "tier": "read",
    "description": "List tracker projects for the current team, newest first. Use this to discover project ids before starting timers or pulling entries. Supports filter by customer id and status (`in_progress` / `completed`). Each row includes the project's customer (id+name) when set. Cursor pagination: pass the `cursor` from the previous page to get the next one."
  },
  {
    "id": "tracker_projects_delete",
    "tier": "destructive",
    "description": "Deletes a time-tracking project."
  },
  {
    "id": "tracker_projects_get",
    "tier": "read",
    "description": "One time-tracking project with totals."
  },
  {
    "id": "tracker_projects_upsert",
    "tier": "write",
    "description": "Creates or updates a time-tracking project (name, rate, currency, customer, estimate)."
  },
  {
    "id": "tracker_start_timer",
    "tier": "write",
    "description": "Start a tracker timer for the current user on a project. Automatically STOPS any timer the user already has running TODAY before creating the new one (mirrors the canonical web behavior — only one running timer per user per day). `start` defaults to now; `assigned_id` defaults to the current user. Returns the newly created entry. Use `tracker_stop_timer` to close it."
  },
  {
    "id": "tracker_stop_timer",
    "tier": "write",
    "description": "Stop the current user's running tracker timer (or a specific entry by id). If duration is under 60 seconds, the entry is DELETED as an accidental tap — the response sets `discarded: true`. Otherwise the entry is updated with `stop` and `duration` (seconds). `entry_id` is optional — when omitted, finds the user's running timer for TODAY. Throws if no running timer exists, the entry is already stopped, or the entry has no `start`."
  },
  {
    "id": "tracker_timer_status",
    "tier": "read",
    "description": "Whether a timer is running and for how long."
  },
  {
    "id": "transaction_attachments_create",
    "tier": "write",
    "description": "Attaches uploaded files (receipts) to transactions."
  },
  {
    "id": "transaction_attachments_delete",
    "tier": "destructive",
    "description": "Removes an attachment from a transaction."
  },
  {
    "id": "transaction_attachments_process",
    "tier": "write",
    "description": "Extracts amount/date/vendor from an attachment."
  },
  {
    "id": "transaction_tags_add",
    "tier": "write",
    "description": "Adds a tag to a transaction."
  },
  {
    "id": "transaction_tags_remove",
    "tier": "write",
    "description": "Removes a tag from a transaction (the tag itself stays)."
  },
  {
    "id": "transactions_attach_document",
    "tier": "write",
    "description": "Attach an already-stored file (a receipt or vendor invoice) to a bank transaction. This is the recommended way to attach a receipt or invoice: one call, checked, and idempotent. Pass `transaction_id` and EXACTLY ONE of `inbox_id` (an Inbox item, from `documents_finalize_upload` with destination 'inbox' or `inbox_list`) or `document_id` (a vault document, from `documents_finalize_upload` with destination 'vault' or `documents_list`). Inbox item: also copies the item's tax amount, rate and type onto the transaction when it has them (overwriting what the transaction held; a tax amount in a different currency than the transaction is scaled into the transaction's currency by transaction amount / item total, and when it cannot be stated that way (no total, a zero total, no currency, or a tax larger than the total) the transaction's tax_amount is cleared) and marks the item done. Vault document: records the attachment, and for PDF and image files queues reading the receipt to set the transaction's tax rate and type (`tax_extraction` says whether that was queued). IDEMPOTENT: attaching the same file to the same transaction again changes nothing and returns `already_attached: true`. Throws if the transaction, inbox item or document does not exist for this team, if an upload has not been finalized yet, or if the inbox item is already matched to a different transaction. To upload a file first use `documents_create_upload_url`; to undo use `transactions_detach_document`."
  },
  {
    "id": "transactions_create",
    "tier": "write",
    "description": "Adds ONE manual transaction to a bank account (name, amount, currency, date, category). FOREIGN-CURRENCY ROWS: pass baseAmount, what the row is worth in the team's base currency, signed like amount (negative = money out) and ideally at the daily rate for the row's date. Reports convert a foreign row by its baseAmount, else a stored exchange rate, and otherwise leave it out and list it in unconverted_currencies. baseAmount must have the same sign as amount; on a row already in the team's base currency it must equal amount or be omitted. baseCurrency, if given, must be the team's base currency (it defaults to it). Unknown fields are refused, not ignored (note the camelCase names: bankAccountId, baseAmount, baseCurrency). For many rows or repeatable loads use transactions_import_rows."
  },
  {
    "id": "transactions_csv_mapping",
    "tier": "write",
    "description": "Suggests column mappings for an uploaded bank CSV from its header row."
  },
  {
    "id": "transactions_delete",
    "tier": "destructive",
    "description": "Permanently delete a transaction. Destructive — confirm with the user before calling. Use update_status to 'archived' or 'excluded' for non-destructive removal. Returns deleted: false if the transaction was already absent — does not throw."
  },
  {
    "id": "transactions_detach_document",
    "tier": "write",
    "description": "Detach a file from a bank transaction (the undo for `transactions_attach_document`): removes the attachment link and, if it was the transaction's last attachment, clears the transaction's tax rate and type. Pass `transaction_id` and EXACTLY ONE of `inbox_id` or `document_id` (the same ids `transactions_attach_document` took). An inbox item goes back to 'pending' so it can be matched again. The stored file is NOT deleted and stays in the Inbox or vault (use `inbox_delete` / `documents_delete` to remove it); attaching it again restores the link. Throws if that file is not attached to that transaction for this team."
  },
  {
    "id": "transactions_export",
    "tier": "write",
    "description": "Starts a CSV/ZIP export of selected transactions; poll jobs_get_status with the returned job id."
  },
  {
    "id": "transactions_get",
    "tier": "read",
    "description": "Fetch one transaction by ID with full details (counterparty, attachments, notes)."
  },
  {
    "id": "transactions_import",
    "tier": "write",
    "description": "Imports a bank statement (CSV with column mappings, or camt) uploaded via create_upload_url into a bank account."
  },
  {
    "id": "transactions_import_rows",
    "tier": "write",
    "description": "Bulk-add up to 500 manual transactions to ONE bank account in a single call, for loading history or syncing from another system. Safe to repeat: a row that is already in the ledger is skipped, not duplicated. A row counts as already there when it has the same external_id, or (with no external_id) the same account, date, amount, currency, name and counterparty, which is also the check the CSV importer uses. Two genuinely separate transactions that match on all of those would collapse into one, so send an external_id on every row when that can happen. A row that fails validation is reported in errors by its position (index, 0-based) and the valid rows are still imported; rows are never half-written. Amounts are signed: negative = money out. FOREIGN-CURRENCY ROWS: set base_amount (what the row is worth in the team's base currency, signed like amount, ideally at the historical daily rate for the row's date) on every row whose currency is not the team's base currency; reports convert a foreign row by its base_amount, else a stored exchange rate, and otherwise drop it and list it in unconverted_currencies. A row already in the base currency gets base_amount = amount automatically. A row that is already in the ledger is skipped, so re-sending it with a base_amount does NOT update the existing row: use transactions_update for that. Unlike transactions_create (one row, no duplicate check) and transactions_import (uploads a bank statement file), this takes the rows inline and is the one to use for scripted, repeatable loads; it also accepts counterparty, tax fields and a category per row, and one row is fine. Returns counts plus skipped_indexes (rows skipped as duplicates). Queues categorisation and receipt matching for the new rows."
  },
  {
    "id": "transactions_list",
    "tier": "read",
    "description": "List bank transactions for the current team, newest first. Supports cursor pagination plus filters by date range, status, category slug, and bank account. Pass the returned nextCursor to fetch the next page."
  },
  {
    "id": "transactions_move_to_review",
    "tier": "write",
    "description": "Moves transactions back to the review queue."
  },
  {
    "id": "transactions_retry_categorization",
    "tier": "write",
    "description": "Re-runs automatic categorization on transactions."
  },
  {
    "id": "transactions_review_count",
    "tier": "read",
    "description": "How many transactions wait for review."
  },
  {
    "id": "transactions_search_match",
    "tier": "read",
    "description": "Transactions that could match a receipt or invoice amount/date/name."
  },
  {
    "id": "transactions_similar",
    "tier": "read",
    "description": "Transactions similar to a name/category (to categorize them together)."
  },
  {
    "id": "transactions_update",
    "tier": "write",
    "description": "Edit an existing transaction: name, amount, currency, date, note, counterparty_name, category_slug, tax_amount, tax_rate, tax_type, internal, or move it to another bank account (bank_account_id). Pass only the fields to change; null clears note, counterparty_name, category_slug and the tax fields. name, amount, currency, date, counterparty_name and bank_account_id can only be changed on MANUAL transactions (ones created with transactions_create, transactions_import_rows, a bank statement import or the app); a row synced from a bank only accepts note, category_slug, tax fields, internal, base_amount and base_currency. Changing the amount clears the stored tax_amount (so tax is recomputed from the rate) unless you also pass tax_amount; changing the category clears the tax fields unless you also pass them. To change only the category or status, transactions_update_category and transactions_update_status are lighter. FOREIGN-CURRENCY ROWS AND REPORTS: base_amount is what the row is worth in the team's base currency (signed like amount; ideally at the daily rate for the row's date); reports convert a foreign row by its base_amount, else a stored exchange rate, and otherwise leave it out and list it in unconverted_currencies, so set base_amount on every foreign-currency row. base_amount (and base_currency, which must be the team's base currency and defaults to it) works on manual AND bank-synced rows. base_amount must have the same sign as the row's amount; on a row already in the team's base currency it must equal amount (it is set automatically). Pass base_amount: null to clear the stored conversion. Changing amount or currency on a manual row never leaves a stale base_amount: a row in the base currency gets base_amount = its new amount, and a foreign row has base_amount cleared unless you also pass a new base_amount. Returns the updated transaction, including base_amount and base_currency."
  },
  {
    "id": "transactions_update_category",
    "tier": "write",
    "description": "Assign a category slug to a transaction. The slug must already exist in the team's categories table — call categories_list first if you're unsure of valid slugs."
  },
  {
    "id": "transactions_update_many",
    "tier": "write",
    "description": "Updates category, status, tags or assignee on several transactions at once."
  },
  {
    "id": "transactions_update_status",
    "tier": "write",
    "description": "Update the workflow status of one transaction (posted | pending | excluded | completed | archived | exported). Use 'archived' or 'excluded' for non-destructive removal — DO NOT use transactions_delete unless the user explicitly asks for permanent deletion."
  },
  {
    "id": "unapplied_payments_applicable_invoices",
    "tier": "read",
    "description": "Open invoices an unapplied payment can be applied to."
  },
  {
    "id": "unapplied_payments_apply",
    "tier": "write",
    "description": "Applies an unapplied payment to an invoice."
  },
  {
    "id": "unapplied_payments_cancel_refund",
    "tier": "write",
    "description": "Cancels a pending refund request."
  },
  {
    "id": "unapplied_payments_list",
    "tier": "read",
    "description": "Customer payments received but not yet matched to an invoice."
  },
  {
    "id": "unapplied_payments_request_refund",
    "tier": "destructive",
    "description": "Requests a refund of an unapplied payment to the customer."
  },
  {
    "id": "update_member_role",
    "tier": "team",
    "description": "Changes a member's role in the team, for example to hand ownership to someone else. Owner only."
  },
  {
    "id": "update_notification_prefs",
    "tier": "account",
    "description": "Turns notification types on or off per channel for the signed-in user in a team. Read the current list with get_notification_prefs first."
  },
  {
    "id": "update_profile",
    "tier": "account",
    "description": "Updates the signed-in user's profile. Only the fields given change. defaultTeamId makes that team the one SuperBooks opens on. The email address is changed in SuperBooks settings, not here."
  },
  {
    "id": "update_team",
    "tier": "team",
    "description": "Updates the team's name, contact email, logo, country, fiscal year start or base currency. Only the fields given change. Returns the team."
  },
  {
    "id": "upgrade_plan",
    "tier": "billing",
    "description": "Starts buying or switching to a plan for the team. Returns a one-time link to a prefilled checkout; the user confirms payment there."
  }
]
