get_incident_stats
Count incidents by group (e.g., priority, assignment group) with optional ServiceNow query filter. Get per-group totals sorted descending for reporting.
Instructions
Count incidents grouped by a field. Use for "how many", "which group has most", reporting.
Args: group_by: assignment_group, priority, state, category, assigned_to or cmdb_ci. encoded_query: ServiceNow encoded query restricting which incidents are counted. Defaults to active incidents only. Examples: "active=true^priority<=2", "opened_at>2026-08-22 00:00:00".
Returns counts per group, largest first. Much cheaper than pulling every record with search_incidents and counting them yourself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_by | No | assignment_group | |
| encoded_query | No | active=true |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |