Method

reconcile.findAutoClear

Find the one set of uncleared splits that brings an account's cleared balance to a figure, as GnuCash's Auto-clear does.

Finds, without changing anything, the one set of uncleared splits that would bring an account's cleared balance to clearedBalance, as GnuCash's Auto-clear button searches. outcome says whether it was found; the splits are those to clear. If several sets reach the figure, or none does, no choice is made for you.

Examples

Example: with a copy of the reports/reconcile example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"reconcile.findAutoClear","params":{"account":"Root:Asset:Bank","clearedBalance":"6.00"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "currentClearedBalance": {
      "num": "2100",
      "denom": "100"
    },
    "outcome": "found",
    "splits": [
      {
        "split": "d0000000000000000000000000000006",
        "description": "desc-4",
        "amount": {
          "num": "-1500",
          "denom": "100"
        },
        "…": "…"
      }
    ],
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash reconcile.findAutoClear '{"account":"Root:Asset:Bank","clearedBalance":"6.00"}'

It prints:

{
  "currentClearedBalance": {
    "num": "2100",
    "denom": "100"
  },
  "outcome": "found",
  "splits": [
    {
      "split": "d0000000000000000000000000000006",
      "description": "desc-4",
      "amount": {
        "num": "-1500",
        "denom": "100"
      },
      "…": "…"
    }
  ],
  "…": "…"
}

MCP tool call

Tool call:

{"name":"reconcile.findAutoClear","arguments":{"account":"Root:Asset:Bank","clearedBalance":"6.00"}}

Result:

{
  "structuredContent": {
    "currentClearedBalance": {
      "num": "2100",
      "denom": "100"
    },
    "outcome": "found",
    "splits": [
      {
        "split": "d0000000000000000000000000000006",
        "description": "desc-4",
        "amount": {
          "num": "-1500",
          "denom": "100"
        },
        "…": "…"
      }
    ],
    "…": "…"
  }
}

Effect: read.

Params

Params of reconcile.findAutoClear and reconcile.autoClear.

  • account (AccountRef, required): The account; its sub-accounts are not included.
  • clearedBalance (Amount, required): The cleared balance wanted, raw sign (debits positive). Rounded to the account's SCU with banker's rounding.

Result

The result of an auto-clear search.

  • account (Guid, required): The account.
  • currentClearedBalance (Amount, required): The account's cleared balance before auto-clear: every split not n, raw sign.
  • clearedBalance (Amount, required): The cleared balance asked for, rounded to the account's SCU.
  • outcome (OutcomeWire, required): What the search found.
  • message (string or null): GnuCash's message for an outcome other than found.
  • splits (array of ClearedSplit, required): The splits found, in account order; empty unless found.