budget.setNotes
Set or delete many budget notes, atomically.
Sets or deletes many budget notes at once, all or none. A note belongs to an account and a period; an empty string or
null deletes it. Notes have no length limit. The checks are those of budget.setAmounts.
Examples
Example: with a new, empty book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"account.create","params":{"name":"Rent","type":"EXPENSE","commodity":"USD"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "…"
}
Request:
{"jsonrpc":"2.0","id":2,"method":"budget.create","params":{"name":"2024","numPeriods":6,"recurrence":{"mult":1,"periodType":"month","start":"2024-01-01"}}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": "…"
}
Request:
{"jsonrpc":"2.0","id":3,"method":"budget.setNotes","params":{"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":"New lease"}]}}
Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"budget": "00ed0000000000000000000000000002",
"set": 1,
"deleted": 0
}
}
Request:
{"jsonrpc":"2.0","id":4,"method":"budget.setNotes","params":{"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":""}]}}
Response:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"budget": "00ed0000000000000000000000000002",
"set": 0,
"deleted": 1
}
}
Command line
red-ale exec --book book.gnucash --script - <<'EOF'
account.create {"name":"Rent","type":"EXPENSE","commodity":"USD"}
budget.create {"name":"2024","numPeriods":6,"recurrence":{"mult":1,"periodType":"month","start":"2024-01-01"}}
budget.setNotes {"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":"New lease"}]}
budget.setNotes {"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":""}]}
EOF
It prints:
[
"…",
"…",
{
"budget": "00ed0000000000000000000000000002",
"set": 1,
"deleted": 0
},
{
"budget": "00ed0000000000000000000000000002",
"set": 0,
"deleted": 1
}
]
MCP tool call
Tool call:
{"name":"account.create","arguments":{"name":"Rent","type":"EXPENSE","commodity":"USD"}}
Result:
{
"content": [
{
"type": "text",
"text": "\"…\""
}
]
}
Tool call:
{"name":"budget.create","arguments":{"name":"2024","numPeriods":6,"recurrence":{"mult":1,"periodType":"month","start":"2024-01-01"}}}
Result:
{
"content": [
{
"type": "text",
"text": "\"…\""
}
]
}
Tool call:
{"name":"budget.setNotes","arguments":{"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":"New lease"}]}}
Result:
{
"structuredContent": {
"budget": "00ed0000000000000000000000000002",
"set": 1,
"deleted": 0
}
}
Tool call:
{"name":"budget.setNotes","arguments":{"budget":"00ed0000000000000000000000000002","notes":[{"account":"Rent","period":0,"note":""}]}}
Result:
{
"structuredContent": {
"budget": "00ed0000000000000000000000000002",
"set": 0,
"deleted": 1
}
}
Effect: write, on the Book.
Params
Params of budget.setNotes.
budget(Guid, required): The budget.notes(array of NoteCell, required): The cells; each at most once.
Result
The result of budget.setNotes.
budget(Guid, required): The budget.set(integer (uint), required): Notes set.deleted(integer (uint), required): Notes deleted.