Skip to content

Conversation

druellan
Copy link

@druellan druellan commented Sep 7, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant