From b6191a0510160aa712ddf985bbd243b7853ccfdc Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 24 Sep 2026 05:54:23 +0200 Subject: [PATCH] fix: stop storing MCP image/audio base64 in file metadata (#30419) When an MCP tool returns an image or audio item, the file is uploaded to storage, but the whole MCP item, including its base64 payload, was also passed as upload metadata. That metadata is persisted in the file table's meta column, so every such result was stored twice: once in storage and once as base64 in the database, growing the DB and every file query that loads meta. The MCP path now passes only chat_id, message_id and session_id, the same metadata the non-MCP tool image path already stores. Nothing reads the removed key. Fixes #30411 --- backend/open_webui/utils/middleware.py | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 523c8bff8b..d8ed066c96 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1195,7 +1195,6 @@ async def process_tool_result( 'chat_id': metadata.get('chat_id', None), 'message_id': metadata.get('message_id', None), 'session_id': metadata.get('session_id', None), - 'result': item, }, user, )