ea9552c fix: merge filter tools with internal tools instead of replacing
📊 Changes
1 file changed (+23 additions, -6 deletions)
View changed files
📝backend/open_webui/utils/middleware.py (+23 -6)
📄 Description
Before submitting, make sure you've checked the following:
Target branch: Verify that the pull request targets the dev branch. PRs targeting main will be immediately closed.
Description: Provide a concise description of the changes made in this pull request down below.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: No user-facing API/env changes.
Dependencies: No new dependencies.
Testing: Manually tested that filter-returned tools merge with internal tools correctly.
Agentic AI Code: This PR has gone through human review and manual testing.
Code review: Self-reviewed for coding standards.
Design & Architecture: Minimal fix with no new settings.
Git Hygiene: Single atomic commit, rebased on dev.
Title Prefix: fix:
Changelog Entry
Description
When a filter function returns provider-native tools, process_chat_payload was overwriting the existing internal tools array instead of merging them. This caused internal tools to be silently dropped when filters added provider-native tools (Fixes#24237).
Added
N/A
Changed
Modified process_chat_payload in backend/open_webui/utils/middleware.py to merge provider-native tools from filters with existing internal tools rather than replacing them.
Deprecated
N/A
Removed
N/A
Fixed
Fixed internal tools being silently dropped when filter functions return provider-native tools (#24237)
If body["tools"] contains only provider-native entries, they are now copied to provider_native_tool_addons and the original tools key is popped, allowing internal tool resolution to proceed normally.
The root cause was that process_chat_payload performed a direct assignment (body["tools"] = filter_tools) which replaced any existing internal tools. The fix merges them instead.
Screenshots or Videos
N/A (backend-only logic change)
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/24307
**Author:** [@aayushbaluni](https://github.com/aayushbaluni)
**Created:** 5/2/2026
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `fix/24237-merge-filter-tools`
---
### 📝 Commits (1)
- [`ea9552c`](https://github.com/open-webui/open-webui/commit/ea9552cc3d94ce16d4e9d80a3d000b16a45a1025) fix: merge filter tools with internal tools instead of replacing
### 📊 Changes
**1 file changed** (+23 additions, -6 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/utils/middleware.py` (+23 -6)
</details>
### 📄 Description
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Verify that the pull request targets the `dev` branch. **PRs targeting `main` will be immediately closed.**
- [x] **Description:** Provide a concise description of the changes made in this pull request down below.
- [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.
- [x] **Documentation:** No user-facing API/env changes.
- [x] **Dependencies:** No new dependencies.
- [x] **Testing:** Manually tested that filter-returned tools merge with internal tools correctly.
- [x] **Agentic AI Code:** This PR has gone through human review and manual testing.
- [x] **Code review:** Self-reviewed for coding standards.
- [x] **Design & Architecture:** Minimal fix with no new settings.
- [x] **Git Hygiene:** Single atomic commit, rebased on dev.
- [x] **Title Prefix:** fix:
# Changelog Entry
### Description
- When a filter function returns provider-native tools, `process_chat_payload` was overwriting the existing internal tools array instead of merging them. This caused internal tools to be silently dropped when filters added provider-native tools (Fixes #24237).
### Added
- N/A
### Changed
- Modified `process_chat_payload` in `backend/open_webui/utils/middleware.py` to merge provider-native tools from filters with existing internal tools rather than replacing them.
### Deprecated
- N/A
### Removed
- N/A
### Fixed
- Fixed internal tools being silently dropped when filter functions return provider-native tools (#24237)
- If `body["tools"]` contains only provider-native entries, they are now copied to `provider_native_tool_addons` and the original `tools` key is popped, allowing internal tool resolution to proceed normally.
### Security
- N/A
### Breaking Changes
- N/A
---
### Additional Information
- Fixes #24237
- The root cause was that `process_chat_payload` performed a direct assignment (`body["tools"] = filter_tools`) which replaced any existing internal tools. The fix merges them instead.
### Screenshots or Videos
- N/A (backend-only logic change)
### Contributor License Agreement
- [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
Made with [Cursor](https://cursor.com)
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24307
Author: @aayushbaluni
Created: 5/2/2026
Status: 🔄 Open
Base:
dev← Head:fix/24237-merge-filter-tools📝 Commits (1)
ea9552cfix: merge filter tools with internal tools instead of replacing📊 Changes
1 file changed (+23 additions, -6 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+23 -6)📄 Description
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.Changelog Entry
Description
process_chat_payloadwas overwriting the existing internal tools array instead of merging them. This caused internal tools to be silently dropped when filters added provider-native tools (Fixes #24237).Added
Changed
process_chat_payloadinbackend/open_webui/utils/middleware.pyto merge provider-native tools from filters with existing internal tools rather than replacing them.Deprecated
Removed
Fixed
body["tools"]contains only provider-native entries, they are now copied toprovider_native_tool_addonsand the originaltoolskey is popped, allowing internal tool resolution to proceed normally.Security
Breaking Changes
Additional Information
process_chat_payloadperformed a direct assignment (body["tools"] = filter_tools) which replaced any existing internal tools. The fix merges them instead.Screenshots or Videos
Contributor License Agreement
Made with Cursor
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.