Skip to content

Commit 5908c9a

Browse files
committed
[SILO-1121] feat: add advanced_search_work_items tool
Add a new MCP tool that exposes the advanced search endpoint, enabling structured filtering of work items by assignee, state, priority, labels, dates, and more using AND/OR logic. This complements the existing search_work_items tool (text search only) with full filter support via the advanced-search API endpoint.
1 parent a219916 commit 5908c9a

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

plane_mcp/tools/work_items.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from plane.models.enums import PriorityEnum
77
from plane.models.query_params import RetrieveQueryParams, WorkItemQueryParams
88
from plane.models.work_items import (
9+
AdvancedSearchResult,
10+
AdvancedSearchWorkItem,
911
CreateWorkItem,
1012
PaginatedWorkItemResponse,
1113
UpdateWorkItem,
@@ -374,3 +376,52 @@ def search_work_items(
374376
)
375377

376378
return client.work_items.search(workspace_slug=workspace_slug, query=query, params=params)
379+
380+
@mcp.tool()
381+
def advanced_search_work_items(
382+
query: str | None = None,
383+
filters: dict | None = None,
384+
project_id: str | None = None,
385+
workspace_search: bool | None = None,
386+
limit: int | None = None,
387+
) -> list[AdvancedSearchResult]:
388+
"""
389+
Search work items with advanced filters using AND/OR logic.
390+
391+
Supports filtering by assignee, state, priority, labels, dates, and more
392+
using structured filter groups. Use this when you need to find work items
393+
matching specific criteria (e.g. unassigned urgent items, items in a
394+
particular state group).
395+
396+
Filter keys include: assignee_id, assignee_id__in, state_id, state_id__in,
397+
state_group, state_group__in, priority, priority__in, label_id, label_id__in,
398+
created_by_id, created_by_id__in, is_draft, is_archived, start_date, target_date,
399+
target_date__range, cycle_id, module_id, subscriber_id, and more.
400+
401+
Args:
402+
query: Optional free-text search string to match against work item
403+
name and description
404+
filters: Optional structured filter dict using AND/OR groups.
405+
Example: {"and": [{"state_group__in": ["unstarted", "started"]},
406+
{"priority__in": ["urgent", "high"]}]}
407+
project_id: Optional project UUID to scope the search to a single project
408+
workspace_search: If true, search across all projects in the workspace
409+
limit: Maximum number of results to return
410+
411+
Returns:
412+
List of AdvancedSearchResult objects
413+
"""
414+
client, workspace_slug = get_plane_client_context()
415+
416+
data = AdvancedSearchWorkItem(
417+
query=query,
418+
filters=filters,
419+
limit=limit,
420+
project_id=project_id,
421+
workspace_search=workspace_search,
422+
)
423+
424+
return client.work_items.advanced_search(
425+
workspace_slug=workspace_slug,
426+
data=data,
427+
)

0 commit comments

Comments
 (0)