fix(scripts): retain web_fetch in OpenRouter tool-capability codegen #657
Problem#
generateChatToolCapabilitiesType() in scripts/convert-openrouter-models.ts emitted only readonly ['web_search'] for the OpenRouterChatModelToolCapabilitiesByName mapped type. The committed packages/ai-openrouter/src/model-meta.ts correctly declares readonly ['web_search', 'web_fetch'], so the next regeneration of the model meta would have silently dropped web_fetch from every chat model's tool capabilities.
Both web_search and web_fetch are real OpenRouter gateway tools available across all chat models (see packages/ai-openrouter/src/tools/web-search-tool.ts and web-fetch-tool.ts).
Fix#
- Emit
readonly ['web_search', 'web_fetch']from the codegen so regeneratingmodel-meta.tsmatches the committed source. - Update the doc comment to mention both plugins.
Notes#
Script-only change — no published package output changes (the committed model-meta.ts already has the correct value), so no changeset is needed.
🤖 Generated with Claude Code
Summary by CodeRabbit#
- New Features
- Chat models now support expanded tool capabilities, including both web search and web fetch functionalities.
- 1
View your CI Pipeline Execution ↗ for commit f4c304dbc7dc62aa416fb72fd917f5e92efdd43e
Command Status Duration Result nx run-many --targets=build --exclude=examples/...✅ Succeeded 1s View ↗
☁️ Nx Cloud last updated this comment at
2026-05-29 14:42:14UTC@tanstack/ai
npm i https://pkg.pr.new/@tanstack/ai@657@tanstack/ai-anthropic
npm i https://pkg.pr.new/@tanstack/ai-anthropic@657@tanstack/ai-client
npm i https://pkg.pr.new/@tanstack/ai-client@657@tanstack/ai-code-mode
npm i https://pkg.pr.new/@tanstack/ai-code-mode@657@tanstack/ai-code-mode-skills
npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@657@tanstack/ai-devtools-core
npm i https://pkg.pr.new/@tanstack/ai-devtools-core@657@tanstack/ai-elevenlabs
npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@657@tanstack/ai-event-client
npm i https://pkg.pr.new/@tanstack/ai-event-client@657@tanstack/ai-fal
npm i https://pkg.pr.new/@tanstack/ai-fal@657@tanstack/ai-gemini
npm i https://pkg.pr.new/@tanstack/ai-gemini@657@tanstack/ai-grok
npm i https://pkg.pr.new/@tanstack/ai-grok@657@tanstack/ai-groq
npm i https://pkg.pr.new/@tanstack/ai-groq@657@tanstack/ai-isolate-cloudflare
npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@657@tanstack/ai-isolate-node
npm i https://pkg.pr.new/@tanstack/ai-isolate-node@657@tanstack/ai-isolate-quickjs
npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@657@tanstack/ai-ollama
npm i https://pkg.pr.new/@tanstack/ai-ollama@657@tanstack/ai-openai
npm i https://pkg.pr.new/@tanstack/ai-openai@657@tanstack/ai-openrouter
npm i https://pkg.pr.new/@tanstack/ai-openrouter@657@tanstack/ai-preact
npm i https://pkg.pr.new/@tanstack/ai-preact@657@tanstack/ai-react
npm i https://pkg.pr.new/@tanstack/ai-react@657@tanstack/ai-react-ui
npm i https://pkg.pr.new/@tanstack/ai-react-ui@657@tanstack/ai-solid
npm i https://pkg.pr.new/@tanstack/ai-solid@657@tanstack/ai-solid-ui
npm i https://pkg.pr.new/@tanstack/ai-solid-ui@657@tanstack/ai-svelte
npm i https://pkg.pr.new/@tanstack/ai-svelte@657@tanstack/ai-utils
npm i https://pkg.pr.new/@tanstack/ai-utils@657@tanstack/ai-vue
npm i https://pkg.pr.new/@tanstack/ai-vue@657@tanstack/ai-vue-ui
npm i https://pkg.pr.new/@tanstack/ai-vue-ui@657@tanstack/openai-base
npm i https://pkg.pr.new/@tanstack/openai-base@657@tanstack/preact-ai-devtools
npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@657@tanstack/react-ai-devtools
npm i https://pkg.pr.new/@tanstack/react-ai-devtools@657@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@657commit:
f4c304dNo actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
d3aa96db-ad3e-4948-9d6d-770ac4119db6📥 Commits
Reviewing files that changed from the base of the PR and between 980ff9ba925f5dbae62a9318cc1e787d0ae24314 and f4c304dbc7dc62aa416fb72fd917f5e92efdd43e.
📒 Files selected for processing (1)
scripts/convert-openrouter-models.ts
📝 Walkthrough
Walkthrough#
The pull request updates a TypeScript code generation script to extend OpenRouter chat model tool capabilities. The
generateChatToolCapabilitiesType()function now emits type definitions annotating each chat model with bothweb_searchandweb_fetchtool capabilities instead ofweb_searchalone.Changes#
OpenRouter Tool Capabilities Expansion
Layer / File(s) Summary Extend chat tool capabilities type
scripts/convert-openrouter-models.tsThe OpenRouterChatModelToolCapabilitiesByNamemapped type is updated to extend the tool-capability tuple fromreadonly ['web_search']toreadonly ['web_search', 'web_fetch']for each chat model.Estimated code review effort#
🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs#
- TanStack/ai#582: Both PRs modify the same OpenRouter tool capabilities type;
#582restored theweb_searchtuple while this PR extends it to includeweb_fetch.
Suggested reviewers#
- crutchcorn
- KevinVandy
Poem#
🐰 A script did whisper, "More tools for the chat! Web search was lonely, so now web fetch's at bat, Two capabilities dance in the tuple so tight, OpenRouter's models now see more light." ✨
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)#
Check name Status Explanation Resolution Description check ⚠️ Warning The description provides clear problem statement, fix details, and implementation notes, but lacks checklist items required by the repository template. Complete the checklist items in the description to confirm testing and changeset requirements have been addressed. Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold. ✏️ Tip: You can configure your own custom pre-merge checks in the settings.✅ Passed checks (3 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and specifically identifies the fix: retaining web_fetch in OpenRouter's tool-capability code generation. Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. ✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch `fix/openrouter-model-gen-web-fetch`
Warning
There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands and usage tips.crutchcorn(GitHub profile, opens in a new tab) approved these changes
AlemTuzlak merged this50c0c61
AlemTuzlak closed this
Sign in to join this conversation.
🚀 Changeset Version Preview#
8 package(s) bumped directly, 22 bumped as dependents.
🟥 Major bumps#
@tanstack/ai-openrouter@tanstack/ai-preact@tanstack/ai-react@tanstack/ai-solid@tanstack/ai-svelte@tanstack/ai-vue@tanstack/ai-anthropic@tanstack/ai-code-mode@tanstack/ai-code-mode-skills@tanstack/ai-elevenlabs@tanstack/ai-event-client@tanstack/ai-fal@tanstack/ai-gemini@tanstack/ai-grok@tanstack/ai-groq@tanstack/ai-isolate-node@tanstack/ai-isolate-quickjs@tanstack/ai-ollama@tanstack/ai-openai@tanstack/ai-react-ui@tanstack/ai-solid-ui@tanstack/openai-base🟨 Minor bumps#
@tanstack/ai@tanstack/ai-client🟩 Patch bumps#
@tanstack/ai-devtools-core@tanstack/ai-isolate-cloudflare@tanstack/ai-vue-ui@tanstack/preact-ai-devtools@tanstack/react-ai-devtools@tanstack/solid-ai-devtools