From 32ff0e8db5ec53e0f834c3f185ff5cec66fa6250 Mon Sep 17 00:00:00 2001 From: Roland Obermair Date: Wed, 14 Jan 2026 13:36:44 +0100 Subject: [PATCH] Fix custom fields not being sent in API payload Custom fields were passed through the tool handler but never copied to the API payload in create_work_package and update_work_package client methods. Added handling for customField* keys: - List-type fields (with href) go to payload["_links"] - Text/number fields go directly to payload Co-Authored-By: Claude Opus 4.5 --- openproject-mcp.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/openproject-mcp.py b/openproject-mcp.py index 5330461..7ed731f 100644 --- a/openproject-mcp.py +++ b/openproject-mcp.py @@ -297,6 +297,18 @@ async def create_work_package(self, data: Dict) -> Dict: if "date" in data: payload["date"] = data["date"] + # Add custom fields (customField1, customField2, etc.) + if "_links" not in payload: + payload["_links"] = {} + for key, value in data.items(): + if key.startswith("customField"): + if isinstance(value, dict) and "href" in value: + # List-type custom field - add to _links + payload["_links"][key] = value + else: + # Text/number custom field - add directly + payload[key] = value + # Create work package return await self._request("POST", "/work_packages", payload) @@ -499,6 +511,18 @@ async def update_work_package(self, work_package_id: int, data: Dict) -> Dict: if "date" in data: payload["date"] = data["date"] + # Add custom fields (customField1, customField2, etc.) + if "_links" not in payload: + payload["_links"] = {} + for key, value in data.items(): + if key.startswith("customField"): + if isinstance(value, dict) and "href" in value: + # List-type custom field - add to _links + payload["_links"][key] = value + else: + # Text/number custom field - add directly + payload[key] = value + return await self._request( "PATCH", f"/work_packages/{work_package_id}", payload )