lot.delete
Delete a lot; its splits stay but leave the lot. A lot with splits needs releaseSplits.
Deletes a lot; its splits stay in the account but leave the lot. A lot that still holds splits is refused with
conflict unless you pass releaseSplits: true, which makes the release explicit (GnuCash's viewer deletes without
asking). A lot that belongs to a business document cannot be deleted.
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.delete","params":{"lot":"10000000000000000000000000000000"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": 2003,
"message": "…",
"data": {
"help": "error/conflict"
}
}
}
Request:
{"jsonrpc":"2.0","id":2,"method":"lot.delete","params":{"lot":"10000000000000000000000000000000","releaseSplits":true}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"releasedSplits": [
"d0000000000000000000000000000000"
]
}
}
Command line
red-ale exec --book book.gnucash --script - <<'EOF'
lot.delete {"lot":"10000000000000000000000000000000"}
lot.delete {"lot":"10000000000000000000000000000000","releaseSplits":true}
EOF
It fails with exit status 2, printing on standard error:
{
"error": {
"code": 2003,
"message": "…",
"data": {
"help": "error/conflict"
}
}
}
MCP tool call
Tool call:
{"name":"lot.delete","arguments":{"lot":"10000000000000000000000000000000"}}
Result:
{
"isError": true,
"structuredContent": {
"error": {
"code": 2003,
"name": "conflict",
"message": "…",
"data": {
"help": "error/conflict"
}
}
}
}
Tool call:
{"name":"lot.delete","arguments":{"lot":"10000000000000000000000000000000","releaseSplits":true}}
Result:
{
"structuredContent": {
"releasedSplits": [
"d0000000000000000000000000000000"
]
}
}
Effect: destructive, on the Book.
Params
Params of lot.delete.
lot(Guid, required): The lot.releaseSplits(boolean): Take the lot's splits out of it first; without this, a lot with splits is refused.
Result
The result of lot.delete.
releasedSplits(array of Guid, required): Splits taken out of the lot.