The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): align inspection surfaces with disabled composite toolsets
aydnOktay2494eadb39d2
diff --git a/hermes_cli/cli_info_mixin.py b/hermes_cli/cli_info_mixin.pyindex 786e2b224f7..d126d61be76 100644--- a/hermes_cli/cli_info_mixin.py+++ b/hermes_cli/cli_info_mixin.py@@ -133,7 +133,8 @@ class CLIInfoMixin:try:from model_tools import get_toolset_for_tooltools = get_tool_definitions(- enabled_toolsets=self.enabled_toolsets, quiet_mode=True)+ enabled_toolsets=self.enabled_toolsets,+ disabled_toolsets=self.disabled_toolsets, quiet_mode=True)availability = compute_toolset_availability(self.enabled_toolsets)tmap = _toolset_map(tools, availability, get_toolset_for_tool)save_banner_snapshot(tools, self.enabled_toolsets, availability, tmap)@@ -146,7 +147,8 @@ class CLIInfoMixin:else:# Cold path: compute live, then persist the snapshot for the next launch.from model_tools import get_toolset_for_tool- tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets, quiet_mode=True)+ tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,+ disabled_toolsets=self.disabled_toolsets, quiet_mode=True)availability = compute_toolset_availability(self.enabled_toolsets)build_welcome_banner(tools=tools, availability=availability, **banner_kw)try:@@ -354,7 +356,8 @@ class CLIInfoMixin:from model_tools import get_toolset_for_tool# Pre-assembly list: /tools is a discovery surface, so it must show the full catalog# including tools deferred behind the tool_search bridge (users verify MCP installs here).- tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets, quiet_mode=True,+ tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,+ disabled_toolsets=self.disabled_toolsets, quiet_mode=True,skip_tool_search_assembly=True)if not tools:print("(;_;) No tools available")diff --git a/hermes_cli/cli_loops_mixin.py b/hermes_cli/cli_loops_mixin.pyindex 14060639c06..fa00827bff0 100644--- a/hermes_cli/cli_loops_mixin.py+++ b/hermes_cli/cli_loops_mixin.py@@ -82,7 +82,8 @@ class CLILoopsMixin:if self.compact or shutil.get_terminal_size().columns < 80:cc.print(_build_compact_banner())else:- tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets, quiet_mode=True)+ tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,+ disabled_toolsets=self.disabled_toolsets, quiet_mode=True)agent = getattr(self, "agent", None)ctx_len = Noneif agent and hasattr(agent, "context_compressor"):diff --git a/hermes_cli/cli_session_mixin.py b/hermes_cli/cli_session_mixin.pyindex e3400b5cb9d..7281d1a3ffe 100644--- a/hermes_cli/cli_session_mixin.py+++ b/hermes_cli/cli_session_mixin.py@@ -216,7 +216,8 @@ class CLISessionMixin:if os.environ.get("HERMES_DEFER_AGENT_STARTUP") == "1":tool_status = "tools deferred"else:- tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets, quiet_mode=True)+ tools = get_tool_definitions(enabled_toolsets=self.enabled_toolsets,+ disabled_toolsets=self.disabled_toolsets, quiet_mode=True)tool_status = f"{len(tools) if tools else 0} tools"model_short = self.model.split("/")[-1] if "/" in self.model else self.modeldiff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.pyindex e10af182e79..699584098f5 100644--- a/hermes_cli/tools_config.py+++ b/hermes_cli/tools_config.py@@ -595,13 +595,40 @@ def _get_platform_tools(config: dict, platform: str, *, include_default_mcp_serv# (e.g. "memory") across all platforms without per-platform toolset configuration. See #86661.if disabled_toolsets:from agent.skill_utils import parse_config_string_list- enabled_toolsets -= {name.strip() for name in parse_config_string_list(disabled_toolsets) if name.strip()}+ disabled_names = [name.strip() for name in parse_config_string_list(disabled_toolsets) if name.strip()]+ enabled_toolsets = _prune_toolsets_stripped_by_disabled(enabled_toolsets, disabled_names)if explicitly_configured and toolset_names:_warn_all_invalid_platform_toolsets(platform, platform_toolsets[platform])return enabled_toolsets+def _prune_toolsets_stripped_by_disabled(enabled_toolsets: Set[str], disabled_names: List[str]) -> Set[str]:+ """Drop disabled names AND every toolset whose tools the runtime would strip anyway.++ The agent subtracts ``agent.disabled_toolsets`` at TOOL granularity (``model_tools._select_tool_names``),+ so disabling a composite like ``debugging`` removes the terminal/web/file tools even though those names+ never appear in the list. A name-only subtraction here left inspection surfaces (``hermes tools+ --summary``, banner, ``/tools``) showing toolsets as enabled that no session could call (#97015).+ Passthrough entries (MCP server names) and toolsets with no static tools (``context_engine``) are kept.+ """+ from model_tools import _apply_toolset_selection+ from toolsets import resolve_toolset, validate_toolset++ remaining = set(enabled_toolsets) - set(disabled_names)+ surviving: Set[str] = set()+ for name in remaining:+ if validate_toolset(name):+ surviving.update(resolve_toolset(name))+ _apply_toolset_selection(surviving, disabled_names, quiet_mode=True, disable=True)+ pruned = set()+ for name in remaining:+ tools = set(resolve_toolset(name)) if validate_toolset(name) else set()+ if tools and not tools & surviving:+ pruned.add(name)+ return remaining - pruned++def _recover_platform_native_toolsets(enabled_toolsets: Set[str], platform: str, *, skip: Set[str]) -> None:"""Add non-configurable platform toolsets (discord, feishu_*) in place: in the default composite but not inCONFIGURABLE_TOOLSETS, so never in a checklist or saved list. Runs for BOTH ``_get_platform_tools`` branches."""diff --git a/tests/hermes_cli/test_tools_config.py b/tests/hermes_cli/test_tools_config.pyindex 5af3c3e37cb..9ae37027c3e 100644--- a/tests/hermes_cli/test_tools_config.py+++ b/tests/hermes_cli/test_tools_config.py@@ -1129,6 +1129,42 @@ def test_agent_disabled_toolsets_python_literal_string_form_still_wins():assert not (_RECENTLY_SHIPPED_TOOLSETS & enabled)+def test_disabled_composite_debugging_prunes_constituent_platform_toolsets():+ """#97015: ``agent.disabled_toolsets: [debugging]`` must hide member+ toolsets on ``hermes tools --summary``, not only strip them at runtime."""+ config = {+ "platform_toolsets": {"cli": ["hermes-cli"]},+ "agent": {"disabled_toolsets": ["debugging"]},+ }+ enabled = _get_platform_tools(config, "cli", include_default_mcp_servers=False)++ assert "terminal" not in enabled+ assert "file" not in enabled+ assert "web" not in enabled+++def test_disabled_composite_debugging_matches_runtime_tool_definitions():+ """CLI inspection surfaces should list the same tools the agent receives."""+ from model_tools import get_tool_definitions++ config = {+ "platform_toolsets": {"cli": ["hermes-cli"]},+ "agent": {"disabled_toolsets": ["debugging"]},+ }+ enabled = sorted(_get_platform_tools(config, "cli", include_default_mcp_servers=False))+ summary_tools = {+ t["function"]["name"]+ for t in get_tool_definitions(+ enabled_toolsets=enabled,+ disabled_toolsets=["debugging"],+ quiet_mode=True,+ )+ }+ assert "terminal" not in summary_tools+ assert "read_file" not in summary_tools+ assert "web_search" not in summary_tools++@_requires_recently_shippeddef test_platforms_whose_composite_excludes_it_are_left_narrow():"""Parity is the justification, so don't widen a deliberately small