Skip to main content
Glama

count_work_items

Read-only

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

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

Behavior4/5

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

Annotations declare readOnlyHint=true and openWorldHint=true; description confirms read-only nature and adds behavioral details about return structure (grouped_counts, sub_grouped_counts). The description adds value beyond annotations.

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?

Well-structured with front-loaded purpose, followed by usage guideline, parameter details, and return format. Every sentence adds value; no unnecessary fluff.

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?

Given the complexity of grouping and nested grouping, the description fully explains all parameters and output structure (with output schema details). It is complete for an agent to effectively use the tool.

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

Parameters4/5

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

Schema only describes pql (33% coverage), but description lists supported values for group_by and sub_group_by, and explains pql usage with examples. This compensates for schema gaps, adding significant meaning.

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?

The description clearly states the tool counts work items with optional grouping, and distinguishes it from fetching full payloads. It specifies the use case for analytics, making the purpose unambiguous.

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

Usage Guidelines4/5

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

Explicitly says to use for analytics without fetching full payloads, providing a clear when-to-use guidance. It contrasts with list_work_items, but lacks explicit when-not-to-use scenarios or alternatives like search_work_items.

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/Bl4nk44/plane-ce-mcp'

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