Skip to content

fix: prevent unavailable tool names from leaking into model schemas#2072

Merged
teknium1 merged 2 commits intomainfrom
hermes/hermes-54c1fc70
Mar 19, 2026
Merged

fix: prevent unavailable tool names from leaking into model schemas#2072
teknium1 merged 2 commits intomainfrom
hermes/hermes-54c1fc70

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

When web_search/web_extract are unavailable (no API key configured), the model was still seeing references to them in two places:

1. execute_code schemasandbox_enabled was computed from tools_to_include (the pre-filter toolset), so the execute_code description listed web_search(query, limit) as an available sandbox import even when the check_fn had filtered it out.

2. browser_navigate schema — Static description said "prefer web_search or web_extract (faster, cheaper)" regardless of tool availability.

The model saw these references, assumed the tools existed, and called them directly — triggering repeated Unknown tool 'web_search' — sending error to model for self-correction errors (reported by user kidtaroi).

Fix

Compute available_tool_names from the post-filter filtered_tools and use that set for:

  • execute_code sandbox tool listing (was using tools_to_include)
  • browser_navigate description patching (strips the web tool sentence when they're unavailable)

Test plan

  • Full test suite passes (5492 passed, 200 skipped)
  • The fix is in get_tool_definitions() in model_tools.py — single file change
Test added 2 commits March 19, 2026 10:04
When web_search/web_extract fail check_fn (no API key configured), their
names were still leaking into tool descriptions via two paths:

1. execute_code schema: sandbox_enabled was computed from tools_to_include
   (pre-filter) instead of the actual available tools (post-filter), so
   the execute_code description listed web_search/web_extract as available
   sandbox imports even when they weren't.

2. browser_navigate schema: hardcoded description said 'prefer web_search
   or web_extract' regardless of whether those tools existed.

The model saw these references, assumed the tools existed, and tried
calling them directly — triggering 'Unknown tool' errors.

Fix: compute available_tool_names from the filtered result set and use
that for both execute_code sandbox listing and browser_navigate description
patching.
@teknium1 teknium1 merged commit 36a4481 into main Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant