aminghadersohi commented on code in PR #43828:
URL: https://github.com/apache/superset/pull/43828#discussion_r3952191284


##########
superset/mcp_service/middleware.py:
##########
@@ -832,18 +835,34 @@ async def on_call_tool(
             # CallToolResult(isError=True) (see ToolResult.to_mcp_result);
             # what keeps it encodable is that structured_content stays None
             # and only the boolean flips false->true, not the structured
-            # payload implicated in the bridge failure above. That leg is
-            # unverified against the live Claude.ai bridge.
+            # payload implicated in transport-level encoding failures.
             return ToolResult(
                 content=[mt.TextContent(type="text", text=error_text)],
                 meta={"mcp_call_id": mcp_call_id} if mcp_call_id else None,
                 is_error=True,
             )
-        if isinstance(result, ToolResult) and result.structured_content is not 
None:
-            result = ToolResult(content=result.content, meta=result.meta)
+        if not self.structured_output_enabled and result.structured_content is 
not None:

Review Comment:
   Applied the guard exactly and widened the middleware callback/return typing 
so task-protocol results are valid. A regression test uses an actual 
`mcp.types.CreateTaskResult` and confirms compatibility mode returns it 
unchanged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to