Method

taxTable.delete

Delete a tax table nothing uses.

Deletes a visible tax table that nothing uses. One with a refcount above zero (a customer, vendor or document line refers to it) is refused with conflict. Its frozen copies stay in the book.

Examples

Example: with a copy of the synthetic/business-editable example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"taxTable.delete","params":{"taxTable":"GST+Levy"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 2003,
    "message": "tax table \"GST+Levy\" is in use and cannot be deleted",
    "data": {
      "help": "error/conflict"
    }
  }
}

Request:

{"jsonrpc":"2.0","id":2,"method":"taxTable.create","params":{"name":"Spare","entries":[{"account":"Liabilities:Tax","amount":"5","type":"percent"}]}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": "…"
}

Request:

{"jsonrpc":"2.0","id":3,"method":"taxTable.delete","params":{"taxTable":"Spare"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {}
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
taxTable.delete {"taxTable":"GST+Levy"}
taxTable.create {"name":"Spare","entries":[{"account":"Liabilities:Tax","amount":"5","type":"percent"}]}
taxTable.delete {"taxTable":"Spare"}
EOF

It fails with exit status 2, printing on standard error:

{
  "error": {
    "code": 2003,
    "message": "tax table \"GST+Levy\" is in use and cannot be deleted",
    "data": {
      "help": "error/conflict"
    }
  }
}

MCP tool call

Tool call:

{"name":"taxTable.delete","arguments":{"taxTable":"GST+Levy"}}

Result:

{
  "isError": true,
  "structuredContent": {
    "error": {
      "code": 2003,
      "name": "conflict",
      "message": "tax table \"GST+Levy\" is in use and cannot be deleted",
      "data": {
        "help": "error/conflict"
      }
    }
  }
}

Tool call:

{"name":"taxTable.create","arguments":{"name":"Spare","entries":[{"account":"Liabilities:Tax","amount":"5","type":"percent"}]}}

Result:

{
  "content": [
    {
      "type": "text",
      "text": "\"…\""
    }
  ]
}

Tool call:

{"name":"taxTable.delete","arguments":{"taxTable":"Spare"}}

Result:

{
  "structuredContent": {}
}

Effect: destructive, on the Book.

Params

Names one tax table.

  • taxTable (TaxTableRef, required): The tax table.

Result

A result with nothing to report.

Type: Done.