From cb2c4f9a0ca4c658f480e6a4ed25acde26356d01 Mon Sep 17 00:00:00 2001 From: tegwick Date: Wed, 18 Mar 2026 02:11:35 +0100 Subject: [PATCH] fix(mcp): accept JSON string for add_progress_event detail param FastMCP validates dict | None strictly, rejecting a JSON string even if parseable. Broaden to dict | str | None and coerce in the function body so callers don't need to pre-parse the detail payload. Co-Authored-By: Claude Sonnet 4.6 --- mcp_server/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mcp_server/server.py b/mcp_server/server.py index bd87fa3..e531362 100644 --- a/mcp_server/server.py +++ b/mcp_server/server.py @@ -547,7 +547,7 @@ def add_progress_event( topic_id: str | None = None, workstream_id: str | None = None, task_id: str | None = None, - detail: dict | None = None, + detail: dict | str | None = None, ) -> str: """Append a progress event to the log. @@ -557,8 +557,13 @@ def add_progress_event( topic_id: optional topic UUID workstream_id: optional workstream UUID task_id: optional task UUID - detail: optional structured data (JSONB) + detail: optional structured data (JSONB); accepts a dict or a JSON string """ + if isinstance(detail, str): + try: + detail = json.loads(detail) + except (json.JSONDecodeError, ValueError): + detail = {"raw": detail} event = _post("/progress", { "topic_id": topic_id, "workstream_id": workstream_id,