Filter tasks by custom field value in the task list API and MCP
OpenSearch & filtersRandy Sauers ·
Summary
GET /task/tasks/{projectId} has no custom field filter. The MCP list_tasks tool mirrors that surface. An agent cannot ask for "all tasks with Doc = PRC-003" or "all tasks with Effort = High" without fetching the whole board and reading each task's custom field values.
Motivation
- Custom fields hold structured references: IDs, document IDs, decision refs, effort.
- The UI can filter by custom field, but the API cannot. The UI filter is client-side, so it does not help agents or scripts.
- Reading custom field values per task is an extra call (
get_task_custom_field_values), so a client-side filter is expensive. - The MCP is the primary interface for agents; it should expose the same filter.
Proposed changes
- Add
field(name or ID) andvaluequery parameters toGET /task/tasks/{projectId}. - Support the field types: text, number, date, dropdown, multiselect, boolean. For dropdown and multiselect, match the option label; for date, match the ISO date; for boolean, match true or false.
- 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}?field=Doc&value=PRC-003returns only tasks with that custom field value.GET /task/tasks/{projectId}?field=Effort&value=Highreturns only tasks with that value.- The filter composes with status, priority, assignee, label, and date filters.
- Pagination counts reflect the filtered set.
- The MCP
list_tasksaccepts the same filter and returns the same set. - Unknown field names or values 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).
- #107 workspace-level shared custom fields (field scope, not filtering).
- #2050 board filter on a custom field bug (closed; UI bug, not API).
- #1986 MCP unable to access custom fields (closed, fixed by #2033; read and write, not filtering).
Additional context
- Current
listTasksparameters: status, priority, assigneeId, page, relatedPage, limit, sortBy, sortOrder, dueBefore, dueAfter. No custom field. - The MCP has
get_task_custom_field_valuesandset_task_custom_field_value, but no filter. - The UI's custom field filter is client-side; the bug #2050 shows it reads from a per-task cache.