open-webui/backend/open_webui/utils/mcp
Classic298 37af63b649
fix: models get an unreadable dump instead of the MCP server's error message (#32942)
* fix: MCP tool errors reach the model as a Python list dump instead of the server's message

When an MCP tool server answered a call with an error, the model got a Python dump of the whole result list, with quotes, annotations and meta fields, instead of the error text the server wrote. Line breaks in the message were escaped as well, so a validation error listing the missing argument was hard to read and models tended to retry the same broken call. The model now gets the server's error text as written, the same way successful results already arrive.

Fixes #32918

* refac: drop the fallback text for MCP errors with no message

The error now carries only the text the server sent.

* fix: keep a readable error when an MCP error has no text

MCP error results that only carry images, audio or resources now give the model a short error message instead of an empty one.
2026-10-25 06:21:30 +09:00
..
client.py fix: models get an unreadable dump instead of the MCP server's error message (#32942) 2026-10-25 06:21:30 +09:00