Skip to main content
Glama

Edit an expense

expense_update

Edit an existing shared flat expense's description, category, total, splits, or receipt image; only the payer can make changes and stale edits are rejected.

Instructions

Edits an existing expense: description, category, total amount, splits or receipt image. Only the payer may edit (otherwise not_payer). To remove an expense, use expense_delete. Send only the fields to change. A new amountCents needs the complete replacement splits in the same call (splits_required_with_amount), and the currency cannot be changed. Splits that stay the same keep their settled state. Pass expectedUpdatedAt (updatedAt from expenses_list) to refuse a stale edit: 409 expense_changed means read again and decide. Side effects: members whose share changed get a push, and the chat notice is refreshed when description or amount changes. The answer holds the updated expense.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "id": "<id>"
    },
    "name": "expense_update"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesId of the expense to edit, from expenses_list.
splitsNoComplete replacement list of debtor shares, summing to the (new) total. Omit to keep the current splits.
wgCodeNoShare code of the flat (code from wg_list). Leave it out when the account belongs to one flat.
categoryNoNew category. Omit to keep the current one.
imageUrlNoURL of a receipt image already uploaded to this flat in the ManaWG app. Omit to keep the current image.
amountCentsNoNew total in cents. Omit to keep the current total; when set, splits must be sent too.
descriptionNoNew title. Omit to keep the current one.
expectedUpdatedAtNoupdatedAt of the expense as last read from expenses_list; guards against editing a stale version.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • changedInput schema / properties / splits / items / properties / amountCents / description
      Previous value: -"Share of this member in cents. All shares together must equal the expense total."New value: +"Share of this member in cents. All shares together must equal the total."
  2. Changed9 schema fields changedv0.1.1
    • addedInput schema / properties / amountCents / description
      Added value: +"New total in cents. Omit to keep the current total; when set, splits must be sent too."
    • addedInput schema / properties / category / description
      Added value: +"New category. Omit to keep the current one."
    • addedInput schema / properties / description / description
      Added value: +"New title. Omit to keep the current one."
    • addedInput schema / properties / expectedUpdatedAt / description
      Added value: +"updatedAt of the expense as last read from expenses_list; guards against editing a stale version."
    • addedInput schema / properties / id / description
      Added value: +"Id of the expense to edit, from expenses_list."
    • addedInput schema / properties / imageUrl / description
      Added value: +"URL of a receipt image already uploaded to this flat in the ManaWG app. Omit to keep the current image."
    • addedInput schema / properties / splits / description
      Added value: +"Complete replacement list of debtor shares, summing to the (new) total. Omit to keep the current splits."
    • addedInput schema / properties / splits / items / properties / amountCents / description
      Added value: +"Share of this member in cents. All shares together must equal the expense total."
    • addedInput schema / properties / splits / items / properties / debtorMemberId / description
      Added value: +"Member who owes this share, from members_list. The payer may appear here to cover their own share."
  3. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnly=false, idempotent=false, destructive=false; the description goes well beyond them. It discloses side effects (pushes to members whose share changed, chat notice refreshed on description/amount change), a domain rule (unchanged splits keep their settled state), an immutable field (currency cannot be changed), and the failure code for stale writes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and permission gate are front-loaded, followed by mutation rules, concurrency, side effects, and return value in a tight sequence of short clauses. Parenthetical error codes are compact and load-bearing rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although there is no output schema, the description closes the loop with "The answer holds the updated expense." For an 8-parameter partial-update tool with permission rules and concurrency control, nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning not in the schema: the split-replacement rule is tied to its error code (splits_required_with_amount), currency is declared immutable, and expectedUpdatedAt is framed as an optimistic-concurrency guard with the 409 outcome. The remaining gap is minor because the schema already documents each field's omit-to-keep semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ("Edits an existing expense") and enumerates the mutable fields: description, category, total amount, splits, receipt image. It also explicitly differentiates itself from the sibling used for the opposite operation, directing removals to expense_delete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use (partial edits, only fields that change) and when-not-to-use (removal goes to expense_delete). It also states a hard precondition (only the payer may edit, otherwise not_payer) and prescribes the concurrency workflow: pass expectedUpdatedAt from expenses_list and re-read on 409 expense_changed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.