Method

docLink.transactions

Transactions with a document link, with the URI each one opens.

Lists the transactions that have a document link, each with the link as stored, whether it is relative and the full uri it opens (the link resolved against the path head). Set a link with the docLink param of transaction.post or transaction.update; an empty string removes it.

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":"docLink.setPathHead","params":{"pathHead":"/home/me/receipts"}}

Response:

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

Request:

{"jsonrpc":"2.0","id":2,"method":"transaction.update","params":{"guid":"c0000000000000000000000000000005","docLink":"may/fuel.pdf"}}

Response:

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

Request:

{"jsonrpc":"2.0","id":3,"method":"docLink.transactions","params":{}}

Response:

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "pathHead": "file:///home/me/receipts/",
    "links": [
      {
        "transaction": "c0000000000000000000000000000005",
        "docLink": "may/fuel.pdf",
        "relative": true,
        "uri": "file:///home/me/receipts/may/fuel.pdf",
        "…": "…"
      }
    ]
  }
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
docLink.setPathHead {"pathHead":"/home/me/receipts"}
transaction.update {"guid":"c0000000000000000000000000000005","docLink":"may/fuel.pdf"}
docLink.transactions {}
EOF

It prints:

[
  "…",
  "…",
  {
    "pathHead": "file:///home/me/receipts/",
    "links": [
      {
        "transaction": "c0000000000000000000000000000005",
        "docLink": "may/fuel.pdf",
        "relative": true,
        "uri": "file:///home/me/receipts/may/fuel.pdf",
        "…": "…"
      }
    ]
  }
]

MCP tool call

Tool call:

{"name":"docLink.setPathHead","arguments":{"pathHead":"/home/me/receipts"}}

Result:

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

Tool call:

{"name":"transaction.update","arguments":{"guid":"c0000000000000000000000000000005","docLink":"may/fuel.pdf"}}

Result:

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

Tool call:

{"name":"docLink.transactions","arguments":{}}

Result:

{
  "structuredContent": {
    "pathHead": "file:///home/me/receipts/",
    "links": [
      {
        "transaction": "c0000000000000000000000000000005",
        "docLink": "may/fuel.pdf",
        "relative": true,
        "uri": "file:///home/me/receipts/may/fuel.pdf",
        "…": "…"
      }
    ]
  }
}

Effect: read.

Params

Params for methods that take none.

Type: NoParams.

Result

The links of one kind, with the path head they were resolved against.

  • pathHead (string or null): The configured path head, if any.
  • links (array of TransactionLink, required): The links.