[PR #246] [MERGED] Feat: Tools can be filtered out using the disabledTools configuration option in the server declaration #212

Closed
opened 2026-02-15 21:15:20 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/mcpo/pull/246
Author: @druellan
Created: 9/7/2025
Status: Merged
Merged: 10/14/2025
Merged by: @tjbck

Base: devHead: disabledTools


📝 Commits (4)

  • 84b5cce Feat: option for disabling individual tools from servers
  • 058fe25 Feat: adding the disabledTools feature to the changelog
  • 7bc2037 Merge branch 'dev' into disabledTools
  • cfa9206 Merge branch 'dev' into disabledTools

📊 Changes

4 files changed (+45 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+6 -0)
📝 README.md (+2 -1)
📝 src/mcpo/main.py (+24 -0)
📝 src/mcpo/tests/test_hot_reload.py (+13 -0)

📄 Description

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.
  • [*] 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: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • Added a feature for disabling individual options from a server.
  • Motivation: dealing with complex servers, sometimes it is desirable to avoid declaring all the features to the model. For example, a MCP server that has both "read" and "write" capabilities, can be important to disable the "write" capabilities.
  • The parameter is based on how Roo code does it.

Added

  • Created a new configuration option disabledTools in the server declaration, to indicate tools that must be filtered out from the model.

Changed

  • main.py - added a new validation for the new option in the mcp.config.json file:
    # Validate disabledTools
    disabled_tools = server_cfg.get("disabledTools")
    if disabled_tools is not None:
        if not isinstance(disabled_tools, list):
            raise ValueError(f"Server '{server_name}' 'disabledTools' must be a list")
        for tool_name in disabled_tools:
            if not isinstance(tool_name, str):
                raise ValueError(f"Server '{server_name}' 'disabledTools' must contain only strings")
  • main.py - added a new filter to remove tools that are listed in the disabledTools option in the mcp.config.json file:
    # Filter out disabled tools
    disabled_tools = getattr(app.state, "disabled_tools", [])
    if disabled_tools:
        original_count = len(tools)
        tools = [tool for tool in tools if tool.name not in disabled_tools]
        filtered_count = original_count - len(tools)
        if filtered_count > 0:
            logger.info(f"Filtered out {filtered_count} tool(s) for server '{app.title}': {disabled_tools}")
  • test_hot_reload.py - added two new tests:

test_validate_server_config_disabled_tools_valid():
test_validate_server_config_disabled_tools_invalid():


Additional Information

I'm rather new to Python development, let me know if everything is ok.


🔄 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/mcpo/pull/246 **Author:** [@druellan](https://github.com/druellan) **Created:** 9/7/2025 **Status:** ✅ Merged **Merged:** 10/14/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `disabledTools` --- ### 📝 Commits (4) - [`84b5cce`](https://github.com/open-webui/mcpo/commit/84b5ccec7076a19e55fe7dc1545135c4fbb42516) Feat: option for disabling individual tools from servers - [`058fe25`](https://github.com/open-webui/mcpo/commit/058fe25f846d394b4da73d7306c7ced9fb3065ef) Feat: adding the disabledTools feature to the changelog - [`7bc2037`](https://github.com/open-webui/mcpo/commit/7bc203705cc8f6cc6bc3ffc238811dcc72db7fc5) Merge branch 'dev' into disabledTools - [`cfa9206`](https://github.com/open-webui/mcpo/commit/cfa92068e0fe610e3589a54b1b07330a3a634ad8) Merge branch 'dev' into disabledTools ### 📊 Changes **4 files changed** (+45 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+6 -0) 📝 `README.md` (+2 -1) 📝 `src/mcpo/main.py` (+24 -0) 📝 `src/mcpo/tests/test_hot_reload.py` (+13 -0) </details> ### 📄 Description # 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](https://keepachangelog.com/) is added at the bottom of the PR description. - [*] **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:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - Added a feature for disabling individual options from a server. - Motivation: dealing with complex servers, sometimes it is desirable to avoid declaring all the features to the model. For example, a MCP server that has both "read" and "write" capabilities, can be important to disable the "write" capabilities. - The parameter is based on how Roo code does it. ### Added - Created a new configuration option `disabledTools` in the server declaration, to indicate tools that must be filtered out from the model. ### Changed - main.py - added a new validation for the new option in the `mcp.config.json` file: ``` # Validate disabledTools disabled_tools = server_cfg.get("disabledTools") if disabled_tools is not None: if not isinstance(disabled_tools, list): raise ValueError(f"Server '{server_name}' 'disabledTools' must be a list") for tool_name in disabled_tools: if not isinstance(tool_name, str): raise ValueError(f"Server '{server_name}' 'disabledTools' must contain only strings") ``` - main.py - added a new filter to remove tools that are listed in the `disabledTools` option in the `mcp.config.json` file: ``` # Filter out disabled tools disabled_tools = getattr(app.state, "disabled_tools", []) if disabled_tools: original_count = len(tools) tools = [tool for tool in tools if tool.name not in disabled_tools] filtered_count = original_count - len(tools) if filtered_count > 0: logger.info(f"Filtered out {filtered_count} tool(s) for server '{app.title}': {disabled_tools}") ``` - test_hot_reload.py - added two new tests: `test_validate_server_config_disabled_tools_valid():` `test_validate_server_config_disabled_tools_invalid():` --- ### Additional Information I'm rather new to Python development, let me know if everything is ok. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 21:15:20 -05:00
yindo closed this issue 2026-02-15 21:15:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/mcpo#212