account.list
List accounts depth first in the book's order, and names that contain the separator.
Lists accounts depth first, each followed by its sub-accounts, in the order GnuCash keeps and writes them. Give
under to list one subtree (the account itself is left out) and excludeHidden to skip hidden accounts. Use
account.tree when you want the nesting rather than a flat list.
nameViolations lists accounts whose names contain the separator :, which GnuCash warns about when it opens such a
book. red-ale refuses to create one.
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":"account.list","params":{"under":"Root:Asset"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"accounts": [
{
"fullName": "Root:Asset:Bank",
"type": "ASSET",
"…": "…"
},
{
"fullName": "Root:Asset:GBP Bank",
"commodity": "CURRENCY::GBP",
"…": "…"
},
{
"fullName": "Root:Asset:Wallet",
"…": "…"
}
],
"nameViolations": []
}
}
Command line
red-ale exec --book book.gnucash account.list '{"under":"Root:Asset"}'
It prints:
{
"accounts": [
{
"fullName": "Root:Asset:Bank",
"type": "ASSET",
"…": "…"
},
{
"fullName": "Root:Asset:GBP Bank",
"commodity": "CURRENCY::GBP",
"…": "…"
},
{
"fullName": "Root:Asset:Wallet",
"…": "…"
}
],
"nameViolations": []
}
MCP tool call
Tool call:
{"name":"account.list","arguments":{"under":"Root:Asset"}}
Result:
{
"structuredContent": {
"accounts": [
{
"fullName": "Root:Asset:Bank",
"type": "ASSET",
"…": "…"
},
{
"fullName": "Root:Asset:GBP Bank",
"commodity": "CURRENCY::GBP",
"…": "…"
},
{
"fullName": "Root:Asset:Wallet",
"…": "…"
}
],
"nameViolations": []
}
}
Effect: read.
Params
Params of account.list.
under(AccountRef or null): List only the descendants of this account; by default every account but the root.excludeHidden(boolean): Leave out accounts hidden themselves or through an ancestor.
Result
The result of account.list.
accounts(array of AccountInfo, required): Accounts, depth first: each followed by its sub-accounts, siblings in the book's order.nameViolations(array of Guid, required): Accounts whose names contain the separator:, which makes full names ambiguous (GnuCash warns about them when it opens a book).