fix(mcp): CLI readers no longer reopen include: [] as "all tools enabled"

The runtime already registers nothing for an explicit empty include list
(fb1ec36a4b), but every CLI reader still coerced `[]` to "no filter":
`hermes mcp list` printed "all", `hermes mcp configure` and `hermes tools`
pre-checked every tool (so confirming the picker silently re-enabled all of
them), and a catalog reinstall pre-checked the manifest defaults over the
user's zero-tool choice.

`_tool_filters` now returns the list whenever the key holds a list; only an
absent/non-list key is None. The pickers and list output branch on `is not
None`, matching `tools/mcp_tool_registration.py`.

Fixes #12865. Builds on #13096 (@dingn42) and #52874 (@Bartok9).
This commit is contained in:
teknium1
2026-09-12 06:43:26 -07:00
committed by Teknium
parent 88d84beede
commit b70e0f4603
5 changed files with 53 additions and 18 deletions
+3 -1
View File
@@ -576,7 +576,9 @@ def _apply_tool_selection(
)
return
pre_set = {n for n in (prior_selection or entry.tools.default_enabled or tool_names) if n in tool_names}
# A prior ``include: []`` (user chose zero tools) outranks manifest defaults, like the non-TTY path.
preferred = prior_selection if prior_selection is not None else (entry.tools.default_enabled or tool_names)
pre_set = {n for n in preferred if n in tool_names}
pre_indices = {i for i, n in enumerate(tool_names) if n in pre_set}
_say(f" Found {len(probed)} tool(s). Pre-checked: {len(pre_indices)}.")