feat: add advanced_search_work_items tool#88
feat: add advanced_search_work_items tool#88lifeiscontent wants to merge 1 commit intomakeplane:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new MCP tool function Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant Tool as advanced_search_work_items
participant Client as MCP Client
participant API as Work Items API
participant Model as AdvancedSearchResult
Caller->>Tool: call advanced_search_work_items(query, filters, project_id, workspace_search, limit)
Tool->>Client: client.work_items.advanced_search(workspace_slug, data=AdvancedSearchWorkItem(...))
Client->>API: HTTP request with payload
API-->>Client: HTTP response (results)
Client-->>Tool: list[AdvancedSearchResult]
Tool-->>Caller: return results
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plane_mcp/tools/work_items.py (1)
35-36: Consider usingLiteraltypes for stricter input validation.The docstring documents specific valid values for
state_groupsandpriorities. For consistency with howcreate_work_itemvalidatespriorityagainstPriorityEnum, you could useLiteraltypes to provide better IDE hints and MCP schema generation.💡 Optional: Add type constraints
+from typing import Literal, get_args + +StateGroup = Literal["backlog", "unstarted", "started", "completed", "cancelled"] + def list_work_items( ... - state_groups: list[str] | None = None, - priorities: list[str] | None = None, + state_groups: list[StateGroup] | None = None, + priorities: list[PriorityEnum] | None = None,This is optional since the backend will handle invalid values gracefully, but it would improve the developer experience with better autocomplete and schema documentation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plane_mcp/tools/work_items.py` around lines 35 - 36, Change the parameter types for state_groups and priorities to use typing.Literal (e.g., list[Literal["backlog","in_progress","done"]] | None and list[Literal["low","medium","high"]] | None) to match the documented valid values and improve IDE/schema hints; add the appropriate import (from typing import Literal) at the top and update any related type hints where these parameters are declared (state_groups, priorities in the function signature in plane_mcp/tools/work_items.py) so they align with the documented values and PriorityEnum validation used in create_work_item.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@plane_mcp/tools/work_items.py`:
- Around line 35-36: Change the parameter types for state_groups and priorities
to use typing.Literal (e.g., list[Literal["backlog","in_progress","done"]] |
None and list[Literal["low","medium","high"]] | None) to match the documented
valid values and improve IDE/schema hints; add the appropriate import (from
typing import Literal) at the top and update any related type hints where these
parameters are declared (state_groups, priorities in the function signature in
plane_mcp/tools/work_items.py) so they align with the documented values and
PriorityEnum validation used in create_work_item.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ae933bc3-fe3c-44f0-9de1-cb7f35f27291
📒 Files selected for processing (1)
plane_mcp/tools/work_items.py
There was a problem hiding this comment.
Pull request overview
This PR extends the list_work_items MCP tool to expose additional server-side filtering options that map to Plane SDK WorkItemQueryParams __in filter fields, enabling callers to narrow results by assignees, states, priorities, labels, creators, and draft/archived status.
Changes:
- Added 8 new optional filter parameters to
list_work_items(assignees, states/groups, priorities, labels, creators, draft, archived). - Wired the new parameters into the
WorkItemQueryParamspassed toclient.work_items.list(...). - Updated the tool docstring to describe the new filters and expected values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
plane_mcp/tools/work_items.py
Outdated
| state_group__in=state_groups, | ||
| priority__in=priorities, | ||
| label_id__in=label_ids, | ||
| created_by_id__in=created_by_ids, |
There was a problem hiding this comment.
state_groups and priorities are currently accepted as list[str] and passed straight into state_group__in / priority__in. Elsewhere in this repo, enum-like inputs are validated against the SDK Literal enums (e.g., GroupEnum in state tools and PriorityEnum in create/update work item tools). Consider typing these as list[GroupEnum] / list[PriorityEnum] (or validating each element against get_args(...)) so invalid values don’t get silently forwarded (or cause a downstream API validation error).
plane_mcp/tools/work_items.py
Outdated
| assignee_ids: Filter by assignee user UUIDs | ||
| state_ids: Filter by state UUIDs | ||
| state_groups: Filter by state groups (backlog, unstarted, started, completed, cancelled) | ||
| priorities: Filter by priority levels (urgent, high, medium, low, none) | ||
| label_ids: Filter by label UUIDs | ||
| created_by_ids: Filter by creator user UUIDs |
There was a problem hiding this comment.
The docstring documents allowed values for state_groups and priorities, but the function signature doesn’t reflect those constraints (both are list[str]). Using the existing SDK enum types (e.g., GroupEnum / PriorityEnum) here would improve the generated tool schema and keep the API self-documenting/consistent with other tools.
|
@lifeiscontent we've fixed this issue in #89 using our advanced work items search API. |
43c200b to
6ee0ea4
Compare
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.
6ee0ea4 to
5908c9a
Compare
Summary
Adds a new
advanced_search_work_itemsMCP 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.New Tool:
advanced_search_work_itemsParameters:
query— optional free-text searchfilters— structured AND/OR filter dict (e.g.{"and": [{"state_group__in": ["unstarted", "started"]}, {"priority__in": ["urgent", "high"]}]})project_id— scope to a specific projectworkspace_search— search across all projectslimit— max resultsSupported filter keys:
assignee_id,state_id,state_group,priority,label_id,created_by_id,is_draft,is_archived,start_date,target_date,cycle_id,module_id,subscriber_id, and their__invariants.Context
This complements the existing
search_work_itemstool (text search only) with full filter support via the existingadvanced-searchAPI endpoint.Dependency
project_idandworkspace_searchsupport inAdvancedSearchWorkItemVerified
Summary by CodeRabbit