Method

price.delete

Delete a price.

Deletes one price and returns it. To thin out many old prices at once, use price.removeOld instead.

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":"price.delete","params":{"price":"e0000000000000000000000000000000"}}

Response:

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

Request:

{"jsonrpc":"2.0","id":2,"method":"price.list","params":{}}

Response:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": [
    {
      "guid": "e0000000000000000000000000000001",
      "…": "…"
    }
  ]
}

Command line

red-ale exec --book book.gnucash --script - <<'EOF'
price.delete {"price":"e0000000000000000000000000000000"}
price.list {}
EOF

It prints:

[
  {
    "guid": "e0000000000000000000000000000000",
    "…": "…"
  },
  [
    {
      "guid": "e0000000000000000000000000000001",
      "…": "…"
    }
  ]
]

MCP tool call

Tool call:

{"name":"price.delete","arguments":{"price":"e0000000000000000000000000000000"}}

Result:

{
  "structuredContent": {
    "guid": "e0000000000000000000000000000000",
    "…": "…"
  }
}

Tool call:

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

Result:

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

Effect: destructive, on the Book.

Params

Params naming one price.

  • price (Guid, required): The price's GUID.

Result

A price.

  • guid (Guid, required): Identity.
  • commodity (CommodityId, required): The commodity priced.
  • currency (CommodityId, required): The currency (or commodity) the value is in.
  • time (Timestamp, required): When the price applies.
  • date (Date or null): The local day of time, which the same-day rules use.
  • source (string or null): Where it came from, such as user:price-editor or Finance::Quote; kept as read even when GnuCash does not know it.
  • type (string or null): Its type, such as last, bid, ask, nav, transaction or unknown.
  • value (Amount, required): Units of currency per unit of commodity, exactly as stored.