agent: Check is_error flag in MCP tool responses (#47095)
Xiaobo Liu
and
Ben Brandt
created
Previously, when an MCP server returned a tool response with
`is_error: true`, the error content was incorrectly treated as
a successful result. This could mislead the LLM into thinking
the tool call succeeded when it actually failed.
Now we check the `is_error` flag and propagate the error message
properly, allowing the agent to handle failures appropriately.
Release Notes:
- N/A
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>