Aggregate table data
table_aggregateCalculate counts, sums, averages, minima, or maxima for a ServiceNow table, optionally grouped by up to three fields, without retrieving full records.
Instructions
Count, average, sum, min or max over a table, optionally grouped by up to 3 fields. Faster and smaller than fetching records. having looks like count^*^>^10. Groups are sorted by orderBy (e.g. count) here, not by ServiceNow. A misspelt field in the query may be ignored by ServiceNow, so check the results.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>"
},
"name": "table_aggregate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| avg | No | Numeric fields to average. | |
| max | No | Fields to take the maximum of. | |
| min | No | Fields to take the minimum of. | |
| sum | No | Numeric fields to add up. | |
| count | No | Include the record count. Default true. | |
| limit | No | Maximum groups to return. Default and cap: the configured maxRecords. | |
| query | No | Encoded query that selects the records. | |
| table | Yes | Table name, e.g. incident or cmdb_ci_server. | |
| having | No | Filter on groups: aggregate^field^operator^value, e.g. count^*^>^10. | |
| groupBy | No | Up to 3 fields to group by, e.g. ["priority", "assignment_group"]. | |
| orderBy | No | Sort order of the groups. | |
| instance | No | Instance alias from the config (see instance_list). Defaults to the default instance. |