Skip to main content
Glama

create_rule

Destructive

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

NameRequiredDescriptionDefault
nameYesShort 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.
filterYesThe 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.
contextYesWrite 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".
clientIdNoThe 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_modelYesThe 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.
operationYesThe 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare destructiveHint=true but the description supplies the consequential context an agent actually needs: effects are async and queue on the next report refresh, the rule lands LAST in precedence order, it will not retro-apply to transactions already stamped by the same operation type, and it requires the Expert plan on the target account (with the `clientId` caveat about whose plan is checked). It also states the failure path — offer `bulk_edit_transactions`, do not retry — which is far beyond annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The critical constraints — persistence, dry-run guardrail, plan gating — are front-loaded and the dry-run is numbered, which suits a destructive tool. However, the spam-directionality warning is stated twice in the body and then a third time inside the operation schema, and the closing `read_me_first` pointer and UI-label paragraph could be tightened.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive, plan-gated, deeply nested filter DSL with no output schema, the definition covers the trigger, the mandatory confirmation workflow, asymmetric spam behavior, async and precedence side effects, and the failure alternative. Nothing an agent needs in order to call it safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3; the description earns an extra point by telling the agent to build the filter via `get_filter_options`, to dry-run with the IDENTICAL filter before calling, and to speak UI labels ('Receive'/'Send') rather than raw enums. Some of the category disambiguation is duplicated in the `toActionType` schema description, which slightly caps the gain.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource — creating a PERSISTENT rule that recategorises matching transactions — and immediately scopes it as covering future imports and syncs. It explicitly contrasts with `bulk_edit_transactions`, so an agent can distinguish this from the nearest sibling without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit trigger ('ONGOING intent — always, from now on, every time, whenever'), an explicit non-trigger with a named alternative (one-off cleanup → `bulk_edit_transactions`), and a mandatory three-step dry-run sequence with the exact tools to call. Spam directionality is also given its own routing rule ('for both directions, dry-run and confirm TWO rules').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources