Skip to content

Commit 637d69d

Browse files
committed
Update to v.1.2.0 with tool filtering.
1 parent cde88e9 commit 637d69d

File tree

4 files changed

+34
-44
lines changed

4 files changed

+34
-44
lines changed

src/postgres_mcp/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
from .statistics import StatisticalTools
4545
from .text import TextProcessingTools
4646
from .tool_filtering import filter_tools_from_server
47-
from .tool_filtering import is_tool_enabled
4847
from .top_queries import TopQueriesCalc
4948
from .vector import VectorTools
5049

src/postgres_mcp/tool_filtering.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def is_tool_enabled(name: str) -> bool:
206206
return name in included
207207

208208

209-
def filter_tools(tools: list["types.Tool"]) -> list["types.Tool"]:
209+
def filter_tools(tools: list[types.Tool]) -> list[types.Tool]:
210210
"""Filter a list of tools based on environment configuration.
211211
212212
Args:
@@ -263,8 +263,4 @@ def filter_tools_from_server(fastmcp_server: Any) -> None:
263263
del tools_dict[tool_name]
264264
logger.debug(f"Removed disabled tool: {tool_name}")
265265

266-
logger.info(
267-
f"Tool filtering applied: {len(tools_dict)} tools remaining "
268-
f"({len(tools_to_remove)} removed)"
269-
)
270-
266+
logger.info(f"Tool filtering applied: {len(tools_dict)} tools remaining ({len(tools_to_remove)} removed)")

tests/unit/test_tool_filtering.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@
1313

1414
import pytest
1515

16-
from postgres_mcp.tool_filtering import (
17-
ALL_TOOLS,
18-
TOOL_GROUPS,
19-
clear_cache,
20-
filter_tools,
21-
get_all_tool_names,
22-
get_available_groups,
23-
get_included_tools,
24-
is_tool_enabled,
25-
)
16+
from postgres_mcp.tool_filtering import ALL_TOOLS
17+
from postgres_mcp.tool_filtering import TOOL_GROUPS
18+
from postgres_mcp.tool_filtering import clear_cache
19+
from postgres_mcp.tool_filtering import filter_tools
20+
from postgres_mcp.tool_filtering import get_all_tool_names
21+
from postgres_mcp.tool_filtering import get_available_groups
22+
from postgres_mcp.tool_filtering import get_included_tools
23+
from postgres_mcp.tool_filtering import is_tool_enabled
2624

2725

2826
class TestToolFilteringBase:
@@ -194,9 +192,7 @@ def test_disable_multiple_groups(self, groups: list[str]) -> None:
194192
result = get_included_tools()
195193

196194
for group in groups:
197-
assert not (
198-
result & TOOL_GROUPS[group]
199-
), f"{group} tools should be excluded"
195+
assert not (result & TOOL_GROUPS[group]), f"{group} tools should be excluded"
200196

201197
def test_disable_all_groups_results_in_empty_set(self) -> None:
202198
"""Disabling all groups should result in empty set."""
@@ -478,4 +474,3 @@ def test_cicd_mode(self) -> None:
478474

479475
if __name__ == "__main__":
480476
pytest.main([__file__, "-v"])
481-

uv.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)