create_rule
Create a PERSISTENT rule that automatically recategorises every transaction matching a filter — including transactions from FUTURE imports and syncs. The rule appears on the user's Rules page and runs on every report refresh.
Use this when the user expresses an ONGOING intent — "always", "from now on", "every time", "whenever" (e.g. "always categorise payments to this address as contractor payments"). For a one-off cleanup of existing transactions use bulk_edit_transactions, which applies once and does not persist.
MANDATORY dry-run first — never skip: 1. Build the filter (use get_filter_options to discover valid values). 2. Run query_summ_transactions with the IDENTICAL filter and tell the user how many existing transactions match. 3. Only after the user explicitly confirms the match set, call this tool with that same filter. An over-broad rule rewrites the user's history on every refresh; the dry-run count is the guardrail.
Spam is directional: spamIn affects incoming transactions only, spamOut outgoing only. NEVER say one rule handles both. For both directions, dry-run and confirm TWO rules: category in → spamIn, and category out → spamOut.
After creating, tell the user: effects are ASYNC (the rule runs on the next report refresh, which this call queues); the rule is appended LAST in their rule precedence order; and it will NOT retro-apply over transactions already stamped by the same operation type.
Requires the Expert plan or higher (the rules engine) on the account the rule is written to — when clientId is passed that is the CLIENT's plan, not the accountant's. If it reports the feature unavailable, offer bulk_edit_transactions as the one-off alternative; don't retry.
Name categories to the user by their UI label, never the raw API enum: deposit→Receive, withdrawal→Send (others usually match). For the full rules (fiat, transfers, what must never be surfaced), read the User-facing wording section of read_me_first if you haven't already.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"filter": "<filter>",
"operation": "<operation>",
"context": "<context>",
"llm_model": "<llm_model>"
},
"name": "create_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Short human-readable rule name shown on the user's Rules page (e.g. "Payments to 0x1234… are contractor payments"). Describe the WHAT, not the tool call. | |
| filter | Yes | The filter selecting which transactions the rule applies to — full NewFilters DSL, the same shape query_summ_transactions reads and bulk_edit_transactions writes with (supports compound 'and'/'or' filters). Use get_filter_options for source values and search_filter_options for to/from/party values. Pass the returned value/filterValue unchanged. | |
| context | Yes | Write one short, abstract, third-person sentence about the task. Refer to the requester only as "the user". Refer to any selected customer, client profile, business, portfolio, account, or data source only as "the client". Never copy, abbreviate, initialize, quote, or paraphrase a user or client name from the conversation, request, or tool data. Never put a name, initials, label, possessive name, business name, email, account name, or identifier before or after "the user" or "the client". Rewrite every named reference to exactly "the user" or "the client". For example, rewrite "User wants to know the inventory method for the client Alex R" as "The user wants to know the inventory method for the client." Do not include wallet names, wallet addresses, transaction hashes, amounts, balances, prices, dates, tax identifiers, account identifiers, or other personal or financial values. Use only generic data categories such as "transactions", "accounts", "wallets", or "tax settings". If a safe abstract summary is not possible, write exactly "the request contains sensitive details". | |
| clientId | No | The client this call acts for — its ID comes from list_clients. Accountants and collaborators: set it on every client-scoped call to operate on that client's data. Only accountant/collaborator accounts have clients; individual accounts omit it. | |
| llm_model | Yes | The exact model identifier you (the assistant) are running as, taken from your system prompt or environment (e.g. "claude-opus-4-8", "gpt-5.2"). Used for analytics only. If you do not know your model identifier with certainty, pass "unknown" — never guess. | |
| operation | Yes | The SINGLE operation the rule applies to every matching transaction. Recategorise sets each matching transaction's category to `toActionType`. One operation never maps both incoming and outgoing categories: a request for both spam directions needs two separately confirmed rules. |