Skip to content

fix: remove redundant tool filtering/prefix logic and fix prefix bug in VeIdentityMcpToolset#532

Open
MengJiapeng wants to merge 1 commit intovolcengine:mainfrom
MengJiapeng:fix/mcp-toolset-redundancy-and-prefix-bug
Open

fix: remove redundant tool filtering/prefix logic and fix prefix bug in VeIdentityMcpToolset#532
MengJiapeng wants to merge 1 commit intovolcengine:mainfrom
MengJiapeng:fix/mcp-toolset-redundancy-and-prefix-bug

Conversation

@MengJiapeng
Copy link

Fixes #531

Summary

This PR fixes redundant code and a critical bug in VeIdentityMcpToolset where the tool name prefix feature was not working correctly.

Changes

Bug Fixes

  • Fixed tool name prefix not being applied: The previous implementation incorrectly modified _name attribute instead of name, causing the prefix feature to completely fail. Now properly delegates to parent class's get_tools_with_prefix() method.

Code Cleanup

  • Removed duplicate _is_tool_selected() method - now uses parent class BaseToolset implementation
  • Removed redundant _tool_filter and _tool_name_prefix attribute storage - now properly passed to and stored by parent class
  • Fixed parent class initialization to properly pass tool_filter and tool_name_prefix parameters

Test Updates

  • Updated existing tests to use correct attribute names (tool_filter, tool_name_prefix instead of _tool_filter, _tool_name_prefix)
  • Added 4 new comprehensive test cases:
    • test_get_tools_with_list_filter - verifies list-based tool filtering
    • test_get_tools_with_predicate_filter - verifies predicate-based tool filtering
    • test_get_tools_with_prefix_applies_correctly - verifies prefix is correctly added via get_tools_with_prefix()
    • test_get_tools_with_prefix_and_filter_combined - verifies prefix and filter work together

Testing

All 15 tests pass:

- Remove duplicate _is_tool_selected method, use parent class implementation
- Remove redundant _tool_filter and _tool_name_prefix storage
- Fix parent class initialization to pass tool_filter and tool_name_prefix
- Remove buggy custom prefix logic that modified _name instead of name
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.

Bug: VeIdentityMcpToolset has redundant tool filtering/prefix logic and a bug in prefix implementation

1 participant