99# A dictionary for mocking TOOL_REGISTRY
1010MOCK_TOOL_REGISTRY = {
1111 'ListIndexTool' : {
12+ 'display_name' : 'ListIndexTool' ,
1213 'description' : 'List indices' ,
1314 'input_schema' : {'type' : 'object' , 'properties' : {'param1' : {'type' : 'string' }}},
1415 'function' : MagicMock (),
1718 'max_version' : '3.0.0' ,
1819 },
1920 'SearchIndexTool' : {
21+ 'display_name' : 'SearchIndexTool' ,
2022 'description' : 'Search an index' ,
2123 'input_schema' : {
2224 'type' : 'object' ,
@@ -162,6 +164,7 @@ def test_get_tools_single_mode_handles_missing_properties(self, mock_patches):
162164 # Create tool with missing properties
163165 tool_without_properties = {
164166 'ListIndexTool' : {
167+ 'display_name' : 'ListIndexTool' ,
165168 'description' : 'List indices' ,
166169 'input_schema' : {'type' : 'object' , 'title' : 'ListIndexArgs' },
167170 'function' : MagicMock (),
@@ -213,13 +216,15 @@ class TestProcessToolFilter:
213216 def setup_method (self ):
214217 """Set up a fresh copy of the tool registry for each test."""
215218 self .tool_registry = {
216- 'ListIndexTool' : {'http_methods' : 'GET' },
217- 'SearchIndexTool' : {'http_methods' : 'GET, POST' },
218- 'MsearchTool' : {'http_methods' : 'GET, POST' },
219- 'ExplainTool' : {'http_methods' : 'GET, POST' },
220- 'ClusterHealthTool' : {'http_methods' : 'GET' },
221- 'IndicesCreateTool' : {'http_methods' : 'PUT' },
222- 'IndicesStatsTool' : {'http_methods' : 'GET' },
219+ 'ListIndexTool' : {'display_name' : 'ListIndexTool' , 'http_methods' : 'GET' },
220+ 'SearchIndexTool' : {'display_name' : 'SearchIndexTool' , 'http_methods' : 'GET, POST' },
221+ 'MsearchTool' : {'display_name' : 'MsearchTool' , 'http_methods' : 'GET, POST' },
222+ 'ExplainTool' : {'display_name' : 'ExplainTool' , 'http_methods' : 'GET, POST' },
223+ 'ClusterHealthTool' : {'display_name' : 'ClusterHealthTool' , 'http_methods' : 'GET' },
224+ 'IndicesCreateTool' : {'display_name' : 'IndicesCreateTool' , 'http_methods' : 'PUT' },
225+ 'IndicesStatsTool' : {'display_name' : 'IndicesStatsTool' , 'http_methods' : 'GET' },
226+ 'CountTool' : {'display_name' : 'CustomCountTool' , 'http_methods' : 'GET' },
227+ 'ListModelTool' : {'display_name' : 'ModelListTool' , 'http_methods' : 'GET' },
223228 }
224229 self .category_to_tools = {
225230 'critical' : ['SearchIndexTool' , 'ExplainTool' ],
@@ -269,3 +274,23 @@ def test_process_tool_filter_env(self, caplog):
269274 assert 'MsearchTool' in self .tool_registry
270275 assert 'SearchIndexTool' not in self .tool_registry # In disabled_tools_regex
271276 assert 'ExplainTool' not in self .tool_registry # In disabled_tools
277+
278+ def test_process_tool_filter_rename_tool (self ):
279+ """Test processing tool filtering with tool renaming feature"""
280+ process_tool_filter (
281+ tool_registry = self .tool_registry ,
282+ disabled_tools = 'CountTool' ,
283+ disabled_tools_regex = 'list.*' ,
284+ allow_write = True
285+ )
286+ assert 'CountTool' in self .tool_registry # Renamed to CustomCountTool
287+ assert 'ListModelTool' in self .tool_registry # Renamed to ModelListTool
288+
289+ process_tool_filter (
290+ tool_registry = self .tool_registry ,
291+ disabled_tools = 'CustomCountTool' ,
292+ disabled_tools_regex = 'model.*' ,
293+ allow_write = True
294+ )
295+ assert 'CustomCountTool' not in self .tool_registry
296+ assert 'ModelListTool' not in self .tool_registry
0 commit comments