Skip to main content
Glama

count_work_items

Count work items with optional grouping by state, priority, project, or assignee. Use PQL filters to get analytics like 'how many urgent items?' without fetching full work item data.

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

TableJSON Schema
NameRequiredDescriptionDefault
pqlNoOptional 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_byNo
sub_group_byNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden and does well: it explains grouping behavior, supported group_by values, the requirement for sub_group_by, and the return format including key types (UUIDs, strings, ISO dates, 'None'). This is thorough behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-organized with clear sections (overview, usage, Args, Returns). Every sentence adds value, and the structure makes it easy to scan. Length is appropriate for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description explicitly documents return fields and their formatting, covering edge cases like 'None' for unset values and UUID vs string keys. This makes the tool fully understandable without external references.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 33%, but the description fully compensates by explaining pql filters with examples, listing all supported group_by values, and noting that sub_group_by requires group_by. It adds substantial meaning beyond the sparse schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool counts work items across the workspace with optional grouping, using a specific verb (count) and resource (work items). It distinguishes from siblings like list_work_items by emphasizing aggregation without fetching full payloads.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to use for analytics questions like 'how many urgent items?' and 'distribution by state?' and notes the benefit of not fetching full work item payloads, implying a contrast with list/search tools. This provides clear when-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leigangzhang/plane-mcp-server-adapter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server