Every total in an answer should be computed by Ceviche, not added up by the assistant. Ceviche MCP's
aggregate tool does the arithmetic in the database, over every matching record, and returns the result with
the checks an accountant would do anyway: what it covers, what it left out, and whether it ties.
The assistant is told never to count rows or add amounts itself. If you see a total and want to know where it came from, ask "what does that cover?" and the assistant can tell you the dataset, the dates and the filter.
Pick the right dataset
The same question can mean different things on bills, lines and splits. The dataset decides.
| Dataset | One row per | Use it for | Group by |
|---|---|---|---|
bills | Bill, at its total | "How much were we billed?" Counts bills the way the transactions page does. | vendor, month, quarter, year, status, currency |
spend | Bill line | Spend by project or account, or line statuses. Lines taken out of their bill are left out. | vendor, month, quarter, year, status, project, account, currency |
allocations | Split, at each entity's share | "How much was charged to Fund II?" Spend by fund or entity. Includes corrections. | entity, vendor, month, quarter, year, status, project, account, currency |
invoices | Fund invoice, at its total | What was invoiced to each fund, and what is paid or open | entity, month, quarter, year, status, currency |
approvals | Approval request, at the amount it is about | Who approved what, what is still open | approver, vendor, month, quarter, year, status, currency |
Spend by fund comes from allocations, because a line becomes a fund's cost only through its split. Asking
spend for a breakdown by entity is refused with that advice.
Measures and ordering
- Measures: sum, count, min, max, and avg (the mean per row, rounded to the cent). Sum and count come back by default, and count always does.
- Group by up to three dimensions at once, for example vendor by quarter, or fund by status.
- Order by the group keys (the default) or by any measure, biggest or smallest first.
- Pages: 50 groups by default, up to 200. When there are more, the answer says so and the assistant can get the next page.
What every total tells you
| Part of the answer | What it says |
|---|---|
| Totals | The sum and count over the whole filter, per currency, whatever page of groups is shown |
| Ties | Yes when the groups add up exactly to the totals, and every split adds up to the line or bill it splits |
| Splits that don't tie | How many, and examples the assistant can open to show each share against what it should add up to |
| Left out | What the default rules left out, with counts and sums: voided bills, lines taken out of their bill, bills with no date, earlier versions of splits that were replaced, bills with no lines |
| Applied | The dataset, filter, grouping and defaults exactly as Ceviche ran them |
| Drill | For each group, the search that lists exactly the records behind it, with the same count and sum |
If the groups ever don't add up to the totals, the answer carries a warning telling the assistant not to use the numbers and to tell you. If the match holds more than one currency, groups and totals are per currency, never added together and never converted.
Worked example
How much in expenses was charged to Fund II in the last two quarters?
On 20 Oct 2026 the last two full quarters are Q2 and Q3 2026. The assistant runs:
dataset: allocations
where: fund:"Fund II" date:2026-Q2..2026-Q3
group_by: quarter
It gets back one group per quarter with its sum and count, a total for the two quarters, ties: yes, and what
was left out (for example, two bills with no date that the date filter couldn't place). A good answer reads:
Fund II was charged $184,220.50 across Q2 and Q3 2026: $97,410.25 in Q2 and $86,810.25 in Q3, across 312 splits. This is Fund II's share of each split only. Voided bills are left out, and 2 bills with no date can't be placed in either quarter.
(The figures are invented.) "Fund II's share only" matters: when a filter names an entity, a split's amount is only its share to that entity, not the whole line. The answer says so because the MCP tells it to.
If "the last two quarters" is ambiguous, for example in the middle of a quarter, a good assistant says which quarters it used. You can always name them: "Q2 and Q3 2026".
More example questions
| You ask | Dataset | Filter and grouping |
|---|---|---|
| Our top 3 vendors in September | bills | date:2026-09, by vendor, biggest first, 3 groups |
| Each fund's share of Q3 costs | allocations | date:2026-Q3, by entity |
| 2026 spend by month and account | spend | date:2026, by month and account |
| Where do September's bills stand? | bills | date:2026-09, by status |
| Who approved what, and what's open | approvals | by approver and status |
| Invoiced to each fund, and the largest invoice | invoices | by entity and status, sum and max |
| Credits and refunds by vendor this year | spend | sign:credit date:2026, by vendor |
Search totals
search also returns totals, summed by Ceviche over everything the search matched (not just the page shown),
per kind of record and per currency. For a quick "how many and how much" on one filter, that is enough. For any
breakdown, the assistant uses aggregate.