Skip to content

feat: tool capability awareness for built-in tools#437

Open
East-rayyy wants to merge 3 commits intodecolua:masterfrom
East-rayyy:feat/tool-capability-awareness
Open

feat: tool capability awareness for built-in tools#437
East-rayyy wants to merge 3 commits intodecolua:masterfrom
East-rayyy:feat/tool-capability-awareness

Conversation

@East-rayyy
Copy link
Copy Markdown
Contributor

@East-rayyy East-rayyy commented Mar 27, 2026

Version 1 of #402

What changed

Built-in tools like web_search_20250305 were silently stripped for non-Claude providers. Now 9router:

  1. Checks a capability map to know which providers support which built-in tools
  2. Strips unsupported tools but injects a system message telling the model what's unavailable
  3. Documents every provider's native web search format for future translation work

Why

When a combo falls through from Claude to another provider, the model had no idea web search was even requested. Now it gets told "web search is not available on this provider" so it can respond accordingly.

Provider research

Every provider in 9router was researched. Results in toolCapabilities.js:

Category Providers
Pass-through (accept Anthropic format) claude, anthropic
Has native search, different format (future translation) gemini family (googleSearch), xai (web_search), perplexity (implicit), openai (web_search_preview), groq (compound models), qwen (enable_search), mistral (agents API), openrouter (plugins), glm (model-agentic), kimi (model-native)
No web search deepseek, together, fireworks, cerebras, nvidia, github, kiro, cursor, minimax, and others
Deprecated cohere (connectors removed Sep 2025), codex (explicitly unsupported)

Backward compatible

Without any config changes, behavior is identical to before — tools still get stripped for unsupported providers. The only difference is the model now knows about it.

Tests

34 new tests. Verified locally and in an isolated k8s environment (Node 22).

Open questions

A few things I'd like your input on @decolua before going further:

  • System message wording — currently injects "Note: web search is not available on this provider. Do not attempt to use it." Is there a better phrasing you'd prefer?
  • Claude-wire providers (glm, kimi, minimax) — I excluded them from pass-through since their backends aren't Anthropic. If any of them actually do accept web_search_20250305, happy to add them back.
  • FUTURE_TRANSLATABLE map — I documented native formats for 13 providers. If any of the format details are wrong or you want to prioritize certain providers for actual translation, let me know and I'll update.

Point out anything you want changed and I'll implement it.

Instead of silently stripping built-in tools (web_search, web_fetch)
for non-Claude providers, 9router now checks a capability map and
injects a system message telling the model that the tool is unavailable.

- Add toolCapabilities.js with provider support map
- Replace blind strip in claudeHelper with capability-aware logic
- Add built-in tool handling for OpenAI-format targets in translator
- 26 new unit tests covering capability map and integration
Research and document every 9router provider's native web search
support in toolCapabilities.js:

Pass-through (Anthropic format): claude, anthropic, glm, kimi,
minimax, minimax-cn, kimi-coding

Future translatable (different format, not yet implemented):
- Gemini/Antigravity/Vertex: google_search grounding tool
- xAI: web_search via /v1/responses
- Perplexity: implicit (all queries search the web)
- OpenAI/Codex: web_search in Responses API only

No native search: deepseek, groq, mistral, together, fireworks,
cerebras, nvidia, github, kiro, cursor, ollama, and others

Add 5 new tests covering the FUTURE_TRANSLATABLE map.
- Remove glm, kimi, minimax from pass-through (they use Claude wire
  format but backends are NOT Anthropic, won't accept web_search_20250305)
- Add groq (compound models), qwen (enable_search), mistral (agents API),
  openrouter (plugins) to FUTURE_TRANSLATABLE
- Remove codex (OpenAI explicitly errors on web_search for codex models)
- Remove cohere (connectors deprecated September 2025)
- Add glm and kimi as model-agentic/model-native search
- Fix googleSearch tool name (was google_search, Gemini uses googleSearch)
- Fix OpenAI tool name (web_search_preview, not web_search)
- Update tests: 34 passing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant