count_work_items
Count work items across your workspace with optional grouping by state, priority, or other dimensions. Filter using PQL to answer analytics questions like 'how many urgent items?'.
Instructions
Count work items across the workspace with optional grouping.
Use this for analytics - "how many urgent items?", "distribution by state?" - without fetching full work item payloads.
Args: pql: PQL filter to scope the count (e.g. 'priority = "urgent"'). group_by: Dimension to group counts by. Supported values: state_id, state__group, priority, project_id, type_id, labels__id, assignees__id, issue_module__module_id, release_work_items__release_id, cycle_id, milestone_id, created_by, target_date, start_date. sub_group_by: Second dimension for nested grouping (requires group_by).
Returns: grouped_by: The group_by field used (null if none). sub_grouped_by: The sub_group_by field used (null if none). total_count: Total matching work items. grouped_counts: Dict of group_key → {count} or {count, sub_grouped_counts} when sub_group_by is set. Keys are UUIDs for FK fields, plain strings for priority/state__group, ISO dates for target_date/start_date, "None" for unset values.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pql | No | Optional Plane Query Language (PQL) filter. Examples: `priority = "urgent" AND assignee = currentUser()`, `stateGroup IN openStates() AND isOverdue()`. UUID fields (project, assignee, state, label, cycle, module, type, milestone, createdBy) need UUIDs - call the relevant `list_*` tool first if you only have a name or short identifier (e.g. `LSS` → call `list_projects` and match `identifier` to get `id`). Call `get_pql_reference` for full PQL syntax before composing complex queries. | |
| group_by | No | ||
| sub_group_by | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||