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


##########
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:
   **🟡 Medium — restore the `isinstance(result, ToolResult)` guard**
   
   In disabled mode a task-augmented `tools/call` (SEP-1686) makes `call_next` 
return a `CreateTaskResult`, which has no `structured_content` attribute — so 
`result.structured_content` here raises `AttributeError` outside the method's 
`try/except`, breaking the task protocol. `LoggingMiddleware` keeps exactly 
this guard. Restore it:
   
   ```suggestion
           if (
               not self.structured_output_enabled
               and isinstance(result, ToolResult)
               and result.structured_content is not None
           ):
   ```



-- 
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