Skip to content

WorkItem model fails Pydantic validation when using expand parameter #69

@blackrat

Description

@blackrat

Description

Using the expand parameter on list_work_items (e.g., expand=state,labels) causes Pydantic validation errors because the WorkItem model expects state as str | None, but the Plane API returns an expanded StateLite dict when expand is used.

Steps to Reproduce

  1. Call list_work_items with expand="state" or expand="state,labels"
  2. Observe Pydantic validation errors:
23 validation errors for PaginatedWorkItemResponse
results.0.state
  Input should be a valid string [type=string_type, input_value={'id': '6a66a67d-...', 'name': 'Ideas', ...}, input_type=dict]

Root Cause

In plane/models/work_items.py, the WorkItem class defines:

state: str | None = None  # line ~45

When expand=state is used, the API returns a StateLite dict instead of a UUID string, which fails validation.

The WorkItemDetail and WorkItemExpand classes in the same file already handle this correctly:

# WorkItemDetail (correct)
state: str | StateLite | None = None

# WorkItemExpand (correct)
state: StateLite | None = None

Suggested Fix

Update WorkItem.state to accept both types:

state: str | StateLite | None = None

The same issue likely applies to labels and assignees fields on WorkItem, which would also return expanded objects when expand is used.

Workaround

Avoid using the expand parameter with list_work_items. Instead, fetch work items without expand and cross-reference state/label UUIDs against list_states / list_labels results separately.

Environment

  • plane-mcp-server version: 0.2.3
  • Python: 3.12
  • Installed via uvx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions