aggregate
Aggregate matching facts to compute COUNT, SUM, MIN, MAX, or AVG on a numeric argument at a specified position. Read-only operation with no side effects.
Instructions
Compute aggregations over matching facts. Supports COUNT, SUM, MIN, MAX, and AVG over a numeric argument at a specified position. Example: COUNT all score(player, ?) facts, or AVG scores at argIndex=1. Side effects: none (read-only). Auth: requires X-Tenant-ID header; FACT_READ permission when auth is enabled. Rate-limited per principal. Errors: VALIDATION_ERROR on unknown operation or missing argIndex for numeric ops.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| predicate | Yes | The predicate to aggregate over | |
| args | Yes | Pattern arguments — use ?x as wildcards, concrete values to constrain | |
| operation | Yes | Aggregation operation: COUNT, SUM, MIN, MAX, or AVG | |
| argIndex | No | 0-based argument position to aggregate for SUM/MIN/MAX/AVG (ignored for COUNT) | |
| scope | No | Optional scope filter |