whodb_platform_ontology_aggregate
Compute exact COUNT, SUM, AVG, MIN, or MAX over an ontology to get grouped or filtered totals instead of raw rows.
Instructions
Compute exact SQL aggregates (COUNT, SUM, AVG, MIN, MAX) over one ontology, optionally grouped and filtered.
Pass group_by for one row per group and metrics for the values; omit group_by for a single total row. where uses the same grammar as whodb_platform_ontology_query (for example {"status":"open","amount":{"gte":100}}); a raw platform WhereCondition object is also accepted. Prefer this over whodb_platform_ontology_query when exact totals matter or the entity is large. Results are capped by limit and the MCP --max-rows setting. Accepts workspace {host, org, project} for per-call targeting without changing defaults.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Ontology id | |
| sort | No | Result ordering by group column or metric alias | |
| limit | No | Maximum groups to return | |
| where | No | Filter object using the same grammar as whodb_platform_ontology_query: {prop: value}, {prop: {op: value}}, _and/_or lists. Ops: eq, neq, gt, gte, lt, lte, contains, icontains, startswith, in, nin, between, isnull. A raw platform WhereCondition object is also accepted. | |
| fields | No | Optional top-level output fields to include | |
| offset | No | Group offset | |
| metrics | Yes | At least one metric: COUNT, SUM, AVG, MIN, MAX | |
| group_by | No | Properties to group by; empty for a single-row total | |
| workspace | No | Optional target for this call only. Omit to use the session default set by whodb_platform_session_use, then process/saved defaults. Discover targets with whodb_platform_hosts, whodb_platform_orgs and whodb_platform_projects. |