generated from coulomb/repo-seed
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user