Filter tasks by label in the task list API and MCP
OpenMCP & APIRandy Sauers ·
Summary
GET /task/tasks/{projectId} accepts status, priority, assignee, date, and pagination filters, but not label. The MCP list_tasks tool mirrors that surface. An agent cannot ask for "all tasks labelled deferred" or "all tasks labelled doc" without fetching the whole board and filtering client-side.
Motivation
- Labels are the cross-cutting taxonomy:
deferred,blocked,task,investigation,build,doc, and domain labels. - The UI can filter by label, but the API cannot. The UI filter is client-side, so it does not help agents or scripts.
- Fetching the whole board to filter by label is expensive on large boards and breaks the pagination contract.
- The MCP is the primary interface for agents; it should expose the same filter.
Proposed changes
- Add
label(name) and/orlabelIdquery parameters toGET /task/tasks/{projectId}. - Support repeated values or a comma-separated list for multiple labels, with an
anyorallmode. - Apply the filter before pagination, consistent with the existing filters.
- Add the same parameters to the MCP
list_taskstool. - Optionally add the filter to the workspace-wide task list when #1959 lands.
Acceptance criteria
GET /task/tasks/{projectId}?label=deferredreturns only tasks with thedeferredlabel.GET /task/tasks/{projectId}?label=doc,buildreturns tasks with either label, or both whenmode=all.- The filter composes with status, priority, assignee, and date filters.
- Pagination counts reflect the filtered set.
- The MCP
list_tasksaccepts the same filter and returns the same set. - Unknown label names return an empty set, not an error, or a clear 400 if the API prefers strict validation.
Checked open issues
- #53 advanced filtering, sorting, grouping and saved views (UI filters, not API or MCP).
- #1959 workspace-wide task list and board with quick assignee filter (adjacent, not label).
- #2051 saved board filter on a label bug (closed; UI bug, not API).
- #1200 label filter shows active after refresh (closed; UI bug, not API).
- #1490 align the label API to per-workspace labels (closed; label API shape, not filtering).
Additional context
- Current
listTasksparameters: status, priority, assigneeId, page, relatedPage, limit, sortBy, sortOrder, dueBefore, dueAfter. No label. - The web UI's label filter is client-side; the commit that added it touched only
apps/webhooks and the board component. - The MCP
list_taskssignature mirrors the API and has no label parameter.