Skip to main content
Glama

Create an expense

expense_create

Creates one expense in the flat with payer and debtor splits summing to the total, and books due fixed costs in the same step so shared balances stay correct.

Instructions

Creates one expense in the flat, paid by the caller or by paidByMemberId and divided into debtor splits whose sum must equal amountCents (otherwise splits_sum_mismatch). Use it for a new purchase or for booking a due fixed cost; to change an existing expense use expense_update, to repay a debt use cash_payment_record or settlement_commit. If someone else paid, the caller must carry a positive share (otherwise paid_by_must_include_caller). To book a due fixed cost send recurringExpenseId and expectedRecurringNextDueAt together (nextDueAt from recurring_get): the expense is created and the template advanced in one step. Side effects: posts a chat notice and notifies the other members by push, not the caller. The answer holds the created expense and a warning that is null when notifications went out normally.

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": {
      "amountCents": "<amountCents>",
      "description": "<description>",
      "splits": "<splits>"
    },
    "name": "expense_create"
  }
}

Input Schema

NameRequiredDescriptionDefault
splitsYesWho owes what. One entry per debtor, no duplicate members, amounts summing to amountCents.
wgCodeNoShare code of the flat (code from wg_list). Leave it out when the account belongs to one flat.
categoryNoSpending category; use other when none fits.other
currencyNoCurrency of the expense and its splits.EUR
imageUrlNoURL of a receipt image already uploaded to this flat in the ManaWG app. Omit unless you have one.
occurredAtNoWhen the purchase happened, ISO 8601 with offset. Omit for now.
amountCentsYesTotal price of the expense in cents, e.g. 1250 for 12.50.
descriptionYesShort title shown in the expense list, e.g. "Groceries".
paidByMemberIdNoMember who paid, from members_list. Omit when the caller paid.
recurringExpenseIdNoId of the fixed cost (recurring_list) this expense books. Send with expectedRecurringNextDueAt.
expectedRecurringNextDueAtNonextDueAt of that fixed cost as read from recurring_get; the booking fails if it has moved.

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. Changed12 schema fields changedv0.1.1
    • addedInput schema / properties / amountCents / description
      Added value: +"Total price of the expense in cents, e.g. 1250 for 12.50."
    • addedInput schema / properties / category / description
      Added value: +"Spending category; use other when none fits."
    • addedInput schema / properties / currency / description
      Added value: +"Currency of the expense and its splits."
    • addedInput schema / properties / description / description
      Added value: +"Short title shown in the expense list, e.g. \"Groceries\"."
    • addedInput schema / properties / expectedRecurringNextDueAt / description
      Added value: +"nextDueAt of that fixed cost as read from recurring_get; the booking fails if it has moved."
    • addedInput schema / properties / imageUrl / description
      Added value: +"URL of a receipt image already uploaded to this flat in the ManaWG app. Omit unless you have one."
    • addedInput schema / properties / occurredAt / description
      Added value: +"When the purchase happened, ISO 8601 with offset. Omit for now."
    • addedInput schema / properties / paidByMemberId / description
      Added value: +"Member who paid, from members_list. Omit when the caller paid."
    • addedInput schema / properties / recurringExpenseId / description
      Added value: +"Id of the fixed cost (recurring_list) this expense books. Send with expectedRecurringNextDueAt."
    • addedInput schema / properties / splits / description
      Added value: +"Who owes what. One entry per debtor, no duplicate members, amounts summing to amountCents."
    • 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.8/5.0
Behavior5/5

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

Annotations only say non-read-only, non-idempotent, non-destructive; the description goes far beyond that by disclosing side effects (chat notice plus push to other members but not the caller), the recurring template advancing in the same step, and the returned warning being null on normal notification. It also surfaces domain error conditions (splits_sum_mismatch, paid_by_must_include_caller) that an agent must avoid, none of which the annotations convey.

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

Conciseness4/5

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

Front-loaded with purpose, then alternatives, then constraints, then side effects and return shape — a sensible ordering with no filler sentences. It is dense and slightly long, with parenthetical error codes adding texture that a skimming agent may skip, but nothing is redundant enough to cut.

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?

For an 11-parameter mutation tool with no output schema, the description covers everything an agent needs: prerequisites (member ids from members_list, recurring_get for nextDueAt), invariants, side effects, and what the response contains. Nothing material is left to inference.

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?

With 100% schema coverage the baseline is 3, and the description earns the bump by stating cross-parameter semantics the schema cannot express: split amounts must sum to amountCents, the caller must hold a positive share when someone else paid, and recurringExpenseId must accompany expectedRecurringNextDueAt. It does not restate field formats, but those are already fully documented in the schema.

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?

The first sentence states a specific verb and resource ("Creates one expense") plus the scope: single expense in the flat, payer resolution, and debtor splits. It is immediately distinguishable from siblings such as expense_update and cash_payment_record, which the description names explicitly.

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?

Usage is pinned in both directions: use for a new purchase or booking a due fixed cost; use expense_update to change an existing expense; use cash_payment_record or settlement_commit to repay a debt. The recurring path is further qualified with the exact parameter pair to send and where nextDueAt comes from (recurring_get).

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