Read a view's groups
Ask the server for each group of a saved view and how many items it holds, to draw a grouped view without reading every item.
An app that draws a grouped view, such as a board with a count on each column, needs every group and how many items it holds. The server counts them in one request, so the app doesn't read every item to count. You need a credential that reads system.view, and the ID of a view.
Ask for the groups
List a view's groups takes the view's ID. This asks for the groups of the view Save and read a view made, which groups photos by month. In the TypeScript example, marfa is a TypeScript SDK client.
marfa views groups <view-id> --time-zone Europe/LisbonThe answer names each group by its key, with the count of items in it:
{
"groups": [
{ "key": "2026-10-01", "count": 2 },
{ "key": "2026-11-01", "count": 1 }
]
}time_zone is the IANA time zone that dates are put into periods in. Leave it out and the server uses UTC. A name that isn't an IANA time zone is refused 400 validation_error.
What the answer holds
- The items are the ones List a view's items lists to the same credential, and no others. That listing ignores the view's
group, so read the groups here and the items there. - The groups come in the view's group order, with those its
group.ordernames first, and without those itsgroup.hiddennames. - The null group has the
keynull. A view with nogroup.bythat lists at least one item answers that one group, holding every item. - A view that lists nothing answers an empty list.
Group the items says which groups each group setting makes.
Groups by an edge
A view grouped by edge[<type>] or backref[<type>] has one group for each item linked, and the group's key is that item's ID.
edge[<type>]counts every edge of that type from a listed item, under the item it points to, even when the credential can't read that item's type.backref[<type>]leaves out an edge whose from item the credential can't read, or that its source filter hides.- A credential that can't read the edge type is refused
403 edge_type_not_permitted.
When the groups are refused
| When | The answer |
|---|---|
| The view lists more than 100,000 items to the credential | 400 validation_error naming group. Narrow the view's query. |
| The view has more than 1,000 groups, once its hidden groups are left out | 400 validation_error naming group.by |
List a view's items refuses the view with a 400 or a 403 | The same status and code |
| No view the credential can read has the ID | 404 item_not_found |
From an agent or a working copy
- Over MCP,
marfa_gettakes one view's ID withgroups: true, andtime_zoneif you need one. It answers the view'sidand itsgroups. An answer past 40,000 characters leaves out the last groups, andleft_outsays how many. groupsgoes alone. With more than one ID, withedgesorfile_link, or withfieldoroffset, the call is refusedvalidation_error. So is atime_zonesent withoutgroups.- A working copy answers the same groups with no connection:
marfa device views groups.
The rules are in the contract's views chapter, under Reading a view's groups.