Skip to content

Commit bf9fb54

Browse files
Enhance OS compatibility check in PluginConfig class (#320)
Added support for tools with os_type=all to always return compatible in the is_os_enabled method. Updated corresponding test cases to reflect this change.
1 parent 7a68424 commit bf9fb54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

mcp_tools/plugin_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ def is_os_enabled(self, os: Optional[str]) -> bool:
340340

341341
os_lower = os.lower()
342342

343+
# Tools with os_type="all" should always be compatible
344+
if os_lower == "all":
345+
return True
346+
343347
# If enabled_os is empty, all OS types are enabled
344348
if not self.enabled_os:
345349
return True

mcp_tools/tests/test_plugin_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def test_os_config_default(monkeypatch):
615615
assert cfg.enabled_os == {"non-windows"}
616616
assert not cfg.is_os_enabled("windows")
617617
assert cfg.is_os_enabled("non-windows")
618-
assert not cfg.is_os_enabled("all")
618+
assert cfg.is_os_enabled("all") # Tools with os_type="all" are always compatible
619619
assert cfg.is_os_enabled(None) # None is always enabled for backward compatibility
620620

621621

@@ -636,7 +636,7 @@ def test_os_config_specific_os(monkeypatch):
636636
assert cfg.enabled_os == {"windows", "non-windows"}
637637
assert cfg.is_os_enabled("windows")
638638
assert cfg.is_os_enabled("non-windows")
639-
assert not cfg.is_os_enabled("all")
639+
assert cfg.is_os_enabled("all") # Tools with os_type="all" are always compatible
640640

641641

642642
def test_os_config_single_os(monkeypatch):
@@ -646,7 +646,7 @@ def test_os_config_single_os(monkeypatch):
646646
assert cfg.enabled_os == {"windows"}
647647
assert cfg.is_os_enabled("windows")
648648
assert not cfg.is_os_enabled("non-windows")
649-
assert not cfg.is_os_enabled("all")
649+
assert cfg.is_os_enabled("all") # Tools with os_type="all" are always compatible
650650

651651

652652
def test_os_config_case_insensitive(monkeypatch):

0 commit comments

Comments
 (0)