mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #24045] [CLOSED] fix: handle 'resource' content type in process_tool_result for MCP tools #66346
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24045
Author: @franciseliang99-dot
Created: 4/23/2026
Status: ❌ Closed
Base:
dev← Head:fix/mcp-resource-type📝 Commits (2)
ec1ffb6fix: handle 'resource' content type in process_tool_result for MCP tools2a9128ffix: guard against non-dict 'resource' field in MCP tool result📊 Changes
1 file changed (+11 additions, -0 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+11 -0)📄 Description
MCP servers can return tool results with
type: "resource"(per the MCP spec), butprocess_tool_result()inbackend/open_webui/utils/middleware.pyonly handlestext,image, andaudio. Resource-type items fall through without being appended totool_response, leaving it empty, so the LLM receives{"results": []}and reports that the server returned no data.This adds an
elif item.get('type') == 'resource'branch that extractsresource.textand attempts a JSON parse — structured payloads (e.g. lists of records) survive as proper data, and plain-text resources fall back to the raw string. The logic mirrors the existingtextbranch.Closes #24038
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.