[PR #14886] [MERGED] Isolated fix to single section #10427

Closed
opened 2025-11-11 19:04:31 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/14886
Author: @2underscores
Created: 6/11/2025
Status: Merged
Merged: 6/16/2025
Merged by: @tjbck

Base: devHead: fix-no-arg-mcp-call


📝 Commits (1)

  • 88c8ea8 Isolated fix to single section

📊 Changes

1 file changed (+14 additions, -4 deletions)

View changed files

📝 backend/open_webui/utils/middleware.py (+14 -4)

📄 Description

This is a fix IF the fix for this issue even belongs in Open WebUI. I'm not sure of the actual best place this one should be fixed, so have raised a discussion for this issue here - https://github.com/open-webui/open-webui/discussions/14882. Discussion has diagrams and more details.

I feel like the fix for this issue does belong in Open WebUI, but feel free to just close this PR if you think it actually belongs somewhere else (e.g. bedrock gateway). If it does belong here, but the late mutation is a bit ugly, I can move it up closer to the response stream receiving part.

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: fix: MCP Tools with Empty Arguments JSON Parsing Error

Changelog Entry

Description

  • Fixed JSON parsing errors when MCP (Model Context Protocol) tools with no arguments are executed, preventing "Expecting value: line 1 column 1 (char 0)" errors
  • Added NODE_OPTIONS build argument support to prevent frontend build memory allocation failures during Docker builds

Changed

  • Tool call argument processing in middleware to convert empty argument strings to valid JSON objects before tool execution
  • Debug log to an actual error log.

Fixed

  • MCP Tool Execution: Fixed JSON parsing errors when MCP tools with no arguments are called, where empty argument strings "" are now properly converted to valid JSON empty objects "{}"

Security

  • [None]

Breaking Changes

  • [None - changes are backward compatible]

Screenshots or Videos

Screenshot shows a before after in a single chat of the error and then fixed
image

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/14886 **Author:** [@2underscores](https://github.com/2underscores) **Created:** 6/11/2025 **Status:** ✅ Merged **Merged:** 6/16/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix-no-arg-mcp-call` --- ### 📝 Commits (1) - [`88c8ea8`](https://github.com/open-webui/open-webui/commit/88c8ea883cd2142b70925a08790ea089946d37e0) Isolated fix to single section ### 📊 Changes **1 file changed** (+14 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+14 -4) </details> ### 📄 Description This is a fix IF the fix for this issue even belongs in Open WebUI. I'm not sure of the actual best place this one should be fixed, so have raised a discussion for this issue here - https://github.com/open-webui/open-webui/discussions/14882. Discussion has diagrams and more details. I feel like the fix for this issue does belong in Open WebUI, but feel free to just close this PR if you think it actually belongs somewhere else (e.g. bedrock gateway). If it does belong here, but the late mutation is a bit ugly, I can move it up closer to the response stream receiving part. # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ ] **Testing:** Have you written and run sufficient tests to validate the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** fix: MCP Tools with Empty Arguments JSON Parsing Error # Changelog Entry ### Description - Fixed JSON parsing errors when MCP (Model Context Protocol) tools with no arguments are executed, preventing "Expecting value: line 1 column 1 (char 0)" errors - Added NODE_OPTIONS build argument support to prevent frontend build memory allocation failures during Docker builds ### Changed - Tool call argument processing in middleware to convert empty argument strings to valid JSON objects before tool execution - Debug log to an actual error log. ### Fixed - **MCP Tool Execution**: Fixed JSON parsing errors when MCP tools with no arguments are called, where empty argument strings `""` are now properly converted to valid JSON empty objects `"{}"` ### Security - [None] ### Breaking Changes - [None - changes are backward compatible] ### Screenshots or Videos Screenshot shows a before after in a single chat of the error and then fixed ![image](https://github.com/user-attachments/assets/508a8b3f-e553-4f5e-9005-3704dd9583ae) ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 19:04:31 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#10427