Method

counter.list

Every counter: the last number issued, its format and the next ID it would give.

Lists the book's counters, which number the business objects (customers, vendors, employees, invoices, bills, expense vouchers, jobs and orders): the last number issued, the format (null for the default %.6li) and the next ID each would give. GnuCash raises a counter each time it issues an ID.

Examples

Example: with a copy of the reports/test-data example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"counter.list","params":{}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "counters": [
      {
        "name": "gncCustomer",
        "last": 0,
        "format": null,
        "normalizedFormat": "%.6li",
        "next": "000001",
        "…": "…"
      },
      "…"
    ]
  }
}

Command line

red-ale exec --book book.gnucash counter.list

It prints:

{
  "counters": [
    {
      "name": "gncCustomer",
      "last": 0,
      "format": null,
      "normalizedFormat": "%.6li",
      "next": "000001",
      "…": "…"
    },
    "…"
  ]
}

MCP tool call

Tool call:

{"name":"counter.list","arguments":{}}

Result:

{
  "structuredContent": {
    "counters": [
      {
        "name": "gncCustomer",
        "last": 0,
        "format": null,
        "normalizedFormat": "%.6li",
        "next": "000001",
        "…": "…"
      },
      "…"
    ]
  }
}

Effect: read.

Params

Params for methods that take none.

Type: NoParams.

Result

The result of counter.list.

  • counters (array of CounterInfo, required): The book options' eight counters in their order, then any others the book holds, by name.