Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions plane_mcp/tools/work_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ def retrieve_work_item(
"""
client, workspace_slug = get_plane_client_context()

# Always expand assignees to get UserLite objects instead of bare UUIDs.
if expand:
if "assignees" not in expand:
expand = f"{expand},assignees"
else:
expand = "assignees"
Comment on lines +181 to +186
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Apply the same assignee expansion to list_work_items().

This fixes the retrieve path, but list_work_items() still forwards expand unchanged on Lines
53-56. The list tool will therefore keep returning bare assignee UUIDs unless callers opt in,
which leaves list and retrieve responses inconsistent with the stated behavior.

Suggested fix
+def _ensure_assignees_expanded(expand: str | None) -> str:
+    expanded_fields = [field.strip() for field in expand.split(",")] if expand else []
+    if "assignees" not in expanded_fields:
+        expanded_fields.append("assignees")
+    return ",".join(expanded_fields)
+
     `@mcp.tool`()
     def list_work_items(
         project_id: str,
         cursor: str | None = None,
         per_page: int | None = None,
@@
         params = WorkItemQueryParams(
             cursor=cursor,
             per_page=per_page,
-            expand=expand,
+            expand=_ensure_assignees_expanded(expand),
             fields=fields,
             order_by=order_by,
             external_id=external_id,
             external_source=external_source,
         )
@@
-        # Always expand assignees to get UserLite objects instead of bare UUIDs.
-        if expand:
-            if "assignees" not in expand:
-                expand = f"{expand},assignees"
-        else:
-            expand = "assignees"
+        expand = _ensure_assignees_expanded(expand)
🤖 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 181 - 186, The list_work_items()
path currently forwards the expand parameter unchanged so assignees remain bare
UUIDs; update list_work_items() to mirror the retrieve path's expansion logic:
when expand is truthy and does not already include "assignees" append
",assignees", otherwise set expand to "assignees" so list responses return
UserLite objects; adjust the code where list_work_items() prepares or forwards
the expand variable (the same expand handling block used for retrieve_work_item)
to ensure consistent behavior.


params = RetrieveQueryParams(
expand=expand,
fields=fields,
Expand Down Expand Up @@ -221,6 +228,13 @@ def retrieve_work_item_by_identifier(
"""
client, workspace_slug = get_plane_client_context()

# Always expand assignees to get UserLite objects instead of bare UUIDs.
if expand:
if "assignees" not in expand:
expand = f"{expand},assignees"
else:
expand = "assignees"

params = RetrieveQueryParams(
expand=expand,
fields=fields,
Expand Down