price.update
Edit a price's value, time, source, type, commodity or currency, as the price editor does.
Edits a price as the price editor does: its value, time, source, type, commodity or currency. Changing the commodity,
currency or time re-adds the price, so the same-day rules apply against the others. Where GnuCash would then drop the
edited price itself (a better-ranked same-day price exists, or an identical one), red-ale refuses with conflict and
changes nothing. type: null clears the type.
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.update","params":{"price":"e0000000000000000000000000000001","value":"1.55","type":"last"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"price": {
"guid": "e0000000000000000000000000000001",
"type": "last",
"value": {
"num": "155",
"denom": "100"
},
"…": "…"
},
"replaced": null
}
}
Command line
red-ale exec --book book.gnucash price.update '{"price":"e0000000000000000000000000000001","value":"1.55","type":"last"}'
It prints:
{
"price": {
"guid": "e0000000000000000000000000000001",
"type": "last",
"value": {
"num": "155",
"denom": "100"
},
"…": "…"
},
"replaced": null
}
MCP tool call
Tool call:
{"name":"price.update","arguments":{"price":"e0000000000000000000000000000001","value":"1.55","type":"last"}}
Result:
{
"structuredContent": {
"price": {
"guid": "e0000000000000000000000000000001",
"type": "last",
"value": {
"num": "155",
"denom": "100"
},
"…": "…"
},
"replaced": null
}
}
Effect: write, on the Book.
Params
Params of price.update. Absent fields are kept.
price(Guid, required): The price to edit.commodity(CommodityId or null): New commodity.currency(CommodityId or null): New currency.date(Date or null): New day (its neutral time).time(Timestamp or null): New exact time.source(string or null): New source: one of GnuCash's price sources.type(string or null): New type; null clears it.value(Amount or null): New value, stored exactly.
Result
What price.update did.
price(PriceInfo, required): The price as it now is.replaced(Guid or null): A same-day price it replaced after moving.