AurimasNav commented on issue #43358:
URL: https://github.com/apache/superset/issues/43358#issuecomment-5352455197
> _Drafted with AI assistance._
Thanks — I verified the suggestion against fastmcp 3.4.7 in a running 6.1.0
instance. It works, with one correction, and the evidence supports the
hypothesis that the bridge is unaffected.
**The suggested code as written raises `TypeError`.** `ToolResult` takes
**`is_error`**, not `isError`:
```
ToolResult.__init__(self, content=..., structured_content=..., meta=...,
is_error: bool = False)
>>> ToolResult(content=[], isError=True)
TypeError: ToolResult.__init__() got an unexpected keyword argument 'isError'
```
**With the right name it produces exactly the wire result we want:**
```python
ToolResult(content=[mt.TextContent(type="text", text="Error: denied")],
is_error=True).to_mcp_result()
# CallToolResult(meta=None,
# content=[TextContent(type='text', text='Error: denied',
...)],
# structuredContent=None,
# isError=True)
```
**That output is also evidence for the bridge question.**
`structuredContent` stays `None` and the content list is plain `TextContent` —
the only delta versus today's behaviour is the boolean. Since #38786 introduced
this middleware to strip `structuredContent`/`outputSchema` and to stop
unencoded exception *objects* reaching the SDK, and neither changes here, the
encoding path the workaround protects is untouched. That is consistent with
your read, though it still wants a real check against the bridge, which I can't
run.
So the change is:
```python
return ToolResult(
content=[mt.TextContent(type="text", text=error_text)],
is_error=True,
meta={"mcp_call_id": mcp_call_id} if mcp_call_id else None,
)
```
Happy to send that with a test asserting `is_error` on the returned
`ToolResult` from that `except` block, alongside the existing middleware tests.
I can't validate against the Claude.ai bridge myself, so that verification
would need to happen in review — if it does regress, option 2 (a transport or
config gate) is the fallback.
--
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]