Dataset Aggregate & Pivot
v0.2.0GROUP BY and pivot tables for JSON rows: 11 functions, date buckets, top N, totals, messy numbers.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_capabilities
Returns the 11 aggregation functions and what each one does, the date bucket formats, the labels used for blank, invalid-date and total rows, and the limits per call (rows, pivot columns, pivot cells, aggregations). Call this first if you are unsure what is available. Free, processes no data.
aggregate_rows
SQL GROUP BY and a spreadsheet pivot table for a list of JSON rows, in one call. Returns one output row per group with the aggregated columns, plus a summary: groups found, groups dropped by topN, values skipped because they were blank or not numeric (never guessed), and warnings such as a misspelled field name. Use it to turn scraped or API records into totals: orders and revenue per region, average price per brand, listings per city per month, top 10 products by revenue. Messy data is expected: "South" and "south " group together, and "$1,234.50" sums as 1234.5. Leave groupByFields empty to…
| Parameter | Type | Description |
|---|---|---|
rows * | array | The records to aggregate, up to 500. Each row is a JSON object; keys may differ between rows. |
aggregations | array | What to compute per group, for example [{"function":"count","alias":"orders"}, {"field":"amount","function":"sum","alias":"total_amount"}]. Every function except count needs a field. alias is the outp… |
dateBucketField | string | A date or timestamp field to group by time period, for example "orderedAt". Adds a group column named like "orderedAt_month". Unreadable dates land in an "(invalid date)" group. |
dateBucketGranularity | string | Bucket size for dateBucketField: day (2026-08-19), week (2026-W34), month (2026-08, default), quarter (2026-Q3) or year. |
groupByFields | array | One output row per distinct combination of these field values, like SQL GROUP BY, for example ["region"] or ["city", "category"]. Dot paths like "address.city" work. Empty or omitted aggregates every… |
groupMatching | string | normalized (default) ignores letter case and extra whitespace when grouping, so "South" and "south " are one group. exact requires identical values. |
includeTotalsRow | boolean | Appends a grand-total row labelled "(total)" and adds a _rowType column ("group" or "total"). |
lenientNumbers | boolean | On by default: "$1,234.50", "49 USD", "12%" and "(300)" count as numbers for sum, avg, min, max and median. Set false to accept only real numbers and plain numeric strings. |
pivotField | string | Turns this field's distinct values into columns, pivot-table style: group by "region" and pivot on "product" for one row per region with a column per product. Must not also be a group-by field. At mos… |
pivotFunction | string | How pivot cell values are combined. Defaults to sum when pivotValueField is set; ignored (row count) without one. |
pivotValueField | string | The field whose values fill the pivot cells, for example "amount". Omitted fills each cell with a row count. |
sortBy | string | An output column to sort by: a group field, an aggregation alias such as "total_amount", or a pivot column. Omitted sorts by the group fields. |
sortDirection | string | asc (default) or desc. Use desc with topN for "top N by" questions. |
topN | integer | After sorting, keep only the first N groups. The totals row still covers every input row. |