lot.scrub
Repair one lot: merge cut pieces, refill it and recompute its capital gains.
Repairs one lot, as GnuCash's lot scrub does: merges split pieces that were cut from one split, refills an overfull
lot, and recomputes its capital gains, recording them in gains transactions in the gains account (an income account
named Orphaned Gains-<CUR> unless the account names another). The result lists what was created, changed and
deleted. It changes nothing in a lot that is already right.
Examples
Example: with a copy of the reports/lots-baseline example book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"lot.scrub","params":{"lot":"10000000000000000000000000000000"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"lotsCreated": [],
"lotsDeleted": [],
"transactionsCreated": [],
"transactionsChanged": [],
"transactionsDeleted": [],
"accountsCreated": []
}
}
Command line
red-ale exec --book book.gnucash lot.scrub '{"lot":"10000000000000000000000000000000"}'
It prints:
{
"lotsCreated": [],
"lotsDeleted": [],
"transactionsCreated": [],
"transactionsChanged": [],
"transactionsDeleted": [],
"accountsCreated": []
}
MCP tool call
Tool call:
{"name":"lot.scrub","arguments":{"lot":"10000000000000000000000000000000"}}
Result:
{
"structuredContent": {
"lotsCreated": [],
"lotsDeleted": [],
"transactionsCreated": [],
"transactionsChanged": [],
"transactionsDeleted": [],
"accountsCreated": []
}
}
Effect: write, on the Book.
Params
Params naming a lot.
lot(Guid, required): The lot.
Result
What a scrub or gains computation changed.
lotsCreated(array of Guid, required): Lots made.lotsDeleted(array of Guid, required): Lots deleted.transactionsCreated(array of Guid, required): Transactions made: gains transactions.transactionsChanged(array of Guid, required): Transactions changed: cut or merged splits, updated gains.transactionsDeleted(array of Guid, required): Transactions deleted: gains transactions of merged splits.accountsCreated(array of Guid, required): Accounts made:Orphaned Gains-<CUR>.