count
Compute the exact total of entities matching an AIP-160 filter, optionally returning per-value group breakdowns via groupBy.
Instructions
Count entities matching an AIP-160 filter — the deterministic answer to "how many …". With groupBy, returns a per-value breakdown (e.g. people per status) instead of a single total. Same filter grammar as the entities tool. Scope: defaults to project+personal; pass scopes:["team"] to include team entities.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Convenience prefilter to one entity kind, AND-combined with filter. | |
| limit | No | Max groups to return when groupBy is set, most-populous first. Defaults to 50. Ignored without groupBy. | |
| filter | No | AIP-160 filter expression selecting which entities to count. Same grammar as the entities tool: reference entity columns (kind, displayName, confidence, resolutionStatus, createTime), fact slots by state_key (e.g. status = "pending"), and related("predicate", "target"). Operators = != < > <= >= : with AND / OR / NOT. | |
| scopes | No | Scope filter: which data partitions to count. Allowed values: project, personal, team. Defaults to [project, personal] when omitted — team entities are hidden unless you pass scopes:["team"]. | |
| groupBy | No | When set, return a per-value breakdown counted by this field instead of a single total. The field is an entity column (kind, resolutionStatus, …) or a fact slot state_key (status, …); entities with no open fact for that slot bucket under the empty value. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Total matching entities. Present when groupBy is not set. | |
| groups | No | Per-value breakdown, most-populous first. Present when groupBy is set. |