feat: tool capability awareness for built-in tools#437
Open
East-rayyy wants to merge 3 commits intodecolua:masterfrom
Open
feat: tool capability awareness for built-in tools#437East-rayyy wants to merge 3 commits intodecolua:masterfrom
East-rayyy wants to merge 3 commits intodecolua:masterfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version 1 of #402
What changed
Built-in tools like
web_search_20250305were silently stripped for non-Claude providers. Now 9router: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: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:
web_search_20250305, happy to add them back.Point out anything you want changed and I'll implement it.