Skip to content

search_work_items sends the wrong query param (q instead of search) — every search returns empty #136

@rubix1138

Description

@rubix1138

search_work_items sends the wrong query param (q instead of search) — every search returns empty

Affected: plane-mcp-server==0.2.8plane-sdk==0.2.8 (both latest on PyPI). Tested against self-hosted Plane Community Edition v1.3.0 with an API key (X-Api-Key).

Dedup note: this is distinct from #98 (retrieve/Pydantic on UUID assignees). This is the search tool returning empty for everything; I couldn't find an existing issue for it.

Summary

client.work_items.search() builds its request with the param name q:

# plane/api/work_items/base.py:191
search_params = {"q": query}
...
response = self._get(f"{workspace_slug}/work-items/search", params=search_params)

The Plane API's /workspaces/{slug}/work-items/search/ endpoint expects the param search, not q. Plane silently ignores the unknown q and returns HTTP 200 {"issues":[]} for every query — so search_work_items looks functional but never returns a hit. This quietly breaks any agent workflow that relies on search (e.g. duplicate detection).

Reproduce (raw HTTP — isolates it from the MCP layer)

# Wrong param (what the SDK sends today) -> always empty
curl -s -H "X-Api-Key: $KEY" \
  "$BASE/api/v1/workspaces/$SLUG/work-items/search/?q=backup"
# => {"issues":[]}

# Correct param -> real results
curl -s -H "X-Api-Key: $KEY" \
  "$BASE/api/v1/workspaces/$SLUG/work-items/search/?search=backup"
# => {"issues":[{"name":"... backup ...", ...}, ...]}

Verified across many terms: search= returns correct hits every time; q= returns empty every time. (And via the MCP tool: search_work_items(query="backup"){"issues":[]}.)

Fix (one line)

# plane/api/work_items/base.py:191
-        search_params = {"q": query}
+        search_params = {"search": query}

Happy to open a PR with this plus a regression test (search round-trip asserting non-empty hits for a known-present term).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions