Method

book.info

Describe the open book: path, read-only state, features and counts.

Describes the open book: its path and format, whether it is dirty (has unsaved changes), whether it is read-only and why, the Book features it declares, and how many accounts, transactions, prices and so on it holds. Call it after book.open to see what you opened, or to check dirty before closing.

counts are the book's own totals; they include hidden accounts and read-only transactions.

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":"book.info","params":{}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "path": "…",
    "readOnly": false,
    "dirty": false,
    "format": "xml",
    "features": [],
    "counts": {
      "commodities": 3,
      "accounts": 11,
      "transactions": 59,
      "prices": 2,
      "…": "…"
    },
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash book.info

It prints:

{
  "path": "…",
  "readOnly": false,
  "dirty": false,
  "format": "xml",
  "features": [],
  "counts": {
    "commodities": 3,
    "accounts": 11,
    "transactions": 59,
    "prices": 2,
    "…": "…"
  },
  "…": "…"
}

MCP tool call

Tool call:

{"name":"book.info","arguments":{}}

Result:

{
  "structuredContent": {
    "path": "…",
    "readOnly": false,
    "dirty": false,
    "format": "xml",
    "features": [],
    "counts": {
      "commodities": 3,
      "accounts": 11,
      "transactions": 59,
      "prices": 2,
      "…": "…"
    },
    "…": "…"
  }
}

Effect: read.

Params

Params for methods that take none.

Type: NoParams.

Result

The result of book.open, book.create and book.info.

  • path (string, required): The book's file.
  • guid (Guid, required): The book's GUID.
  • rootAccount (Guid, required): The root account's GUID.
  • readOnly (boolean, required): Nothing can be changed.
  • readOnlyReasons (array of ReadOnlyInfo, required): Why, when read-only.
  • dirty (boolean, required): There are unsaved changes.
  • compressed (boolean, required): The file is gzip-compressed; always false for an SQLite book.
  • format (BookFormat, required): The file's format: xml or sqlite.
  • versions (array of VersionInfo or null): SQLite books only: the versions table as read, in its order.
  • journal (string or null): The transaction journal being written, if any.
  • features (array of FeatureInfo, required): Book features the book declares.
  • counts (Counts, required): Entity counts.