Skip to content

blog: type-safe provider tools in TanStack AI#847

Merged
tannerlinsley merged 2 commits intoTanStack:mainfrom
AlemTuzlak:blog/type-safe-provider-tools
Apr 22, 2026
Merged

blog: type-safe provider tools in TanStack AI#847
tannerlinsley merged 2 commits intoTanStack:mainfrom
AlemTuzlak:blog/type-safe-provider-tools

Conversation

@AlemTuzlak
Copy link
Copy Markdown
Contributor

@AlemTuzlak AlemTuzlak commented Apr 22, 2026

Summary

New blog post announcing per-model compile-time type safety for provider tools in TanStack AI, plus the new /tools subpath on every adapter.

  • Explains the silent-failure bug class (passing a provider tool to a model that does not support it)
  • Walks through the ProviderTool<TProvider, TKind> phantom-branded subtype that gates tools: [...] at the type level
  • Shows the user-defined toolDefinition / customTool escape hatch that stays universally assignable
  • Contrasts the native-per-provider approach with gateway-style abstractions
  • Demonstrates the /tools subpath on every adapter for tree-shakeable imports

Adds:

  • src/blog/type-safe-provider-tools-tanstack-ai.md
  • public/blog-assets/type-safe-provider-tools-tanstack-ai/header.png

Test plan

  • Preview the post locally and confirm header image renders
  • Confirm frontmatter parses (title, published, excerpt, authors)
  • Confirm code blocks render with TypeScript highlighting
  • Confirm internal link to /ai/latest/docs/tools/provider-tools resolves once the docs page is deployed

Summary by CodeRabbit

  • Documentation
    • Added blog post explaining type-safe provider tools in TanStack AI, detailing how provider tools are now constrained at compile time to prevent incompatibilities with specific models and adapters.
    • Documented the tree-shakeable /tools subpath for importing provider tools from TanStack AI provider packages.

Adds a blog post introducing per-model compile-time type safety for
provider tools, announcing the new /tools subpath on every adapter and
the phantom-branded ProviderTool type that gates incompatible model +
tool pairings at compile time.
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

👷 Deploy request for tanstack pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bfe2631

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

A new blog post has been added documenting TanStack AI type safety improvements. The article explains how provider tool factories now return phantom-branded types and adapters carry per-model tool capability information, preventing provider-tool/model mismatches at compile time.

Changes

Cohort / File(s) Summary
Blog Documentation
src/blog/type-safe-provider-tools-tanstack-ai.md
New blog post (+155 lines) documenting TanStack AI's type-safe provider tools feature, explaining the fix for preventing runtime mismatches between provider tools and models through compile-time type constraints.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 ✨ A post so fine, on types so bright,
Provider tools now match just right!
No more mismatches left to hide—
The compiler's our trusty guide! 📝

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: adding a blog post about type-safe provider tools in TanStack AI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/blog/type-safe-provider-tools-tanstack-ai.md (1)

134-134: Consider hyphenating compound modifier (minor style).

"per-model type gating" could be hyphenated as "per-model type-gating" to follow compound modifier conventions, though the current phrasing is clear and aligns with the informal tone used throughout the post.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/blog/type-safe-provider-tools-tanstack-ai.md` at line 134, Summary:
Hyphenate the compound modifier "per-model type gating" to "per-model
type-gating" in the sentence beginning "The tradeoff of the native approach is
obvious..." to follow compound modifier conventions; locate that sentence and
replace the phrase "per-model type gating" with "per-model type-gating" so the
compound modifier is correctly hyphenated while preserving the existing tone and
punctuation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/blog/type-safe-provider-tools-tanstack-ai.md`:
- Around line 23-31: Update the outdated model identifiers in the table: replace
`claude-3-haiku` and `claude-3-5-haiku` with `claude-haiku-4.5`, change
`claude-opus-4-6` to `claude-opus-4.7`, replace `gpt-3.5-turbo` with the current
GPT lineup entries (`gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`) (you can list
them as separate rows or comma-separated under the Model column), and change
`gemini-3-pro` to `gemini-3.1-pro` and `gemini-lite` to `gemini-3.1-flash-lite`;
keep the Provider tools supported column values unchanged for each corresponding
model entry so the tool support matrix remains accurate.

---

Nitpick comments:
In `@src/blog/type-safe-provider-tools-tanstack-ai.md`:
- Line 134: Summary: Hyphenate the compound modifier "per-model type gating" to
"per-model type-gating" in the sentence beginning "The tradeoff of the native
approach is obvious..." to follow compound modifier conventions; locate that
sentence and replace the phrase "per-model type gating" with "per-model
type-gating" so the compound modifier is correctly hyphenated while preserving
the existing tone and punctuation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 854f106a-5c6e-484c-aa1d-86a922f92a93

📥 Commits

Reviewing files that changed from the base of the PR and between eb49d0e and bfe2631.

⛔ Files ignored due to path filters (1)
  • public/blog-assets/type-safe-provider-tools-tanstack-ai/header.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • src/blog/type-safe-provider-tools-tanstack-ai.md

Comment on lines +23 to +31
| Model | Provider tools supported |
| ------------------ | ----------------------------------------------------------------------- |
| `claude-3-haiku` | `web_search` only |
| `claude-3-5-haiku` | web tools only (`web_search`, `web_fetch`) |
| `claude-opus-4-6` | full superset (web, code execution, computer use, bash, editor, memory) |
| `gpt-3.5-turbo` | none |
| `gpt-5` family | full superset |
| `gemini-3-pro` | full superset |
| `gemini-lite` | narrower subset |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

What are the current Claude, GPT, and Gemini model names available as of April 2026, and which provider tools (web search, code interpreter, computer use) does each support?

💡 Result:

As of April 2026: Claude (Anthropic): - Current models: Claude Opus 4.7 (most capable), Claude Sonnet 4.6, Claude Haiku 4.5 (primary generally available); older like Opus 4.6, Sonnet 4.5 still available but migrate recommended. - Provider tools: Web search (yes, with dynamic filtering on newer versions), Code interpreter/execution (yes, code_execution tool), Computer use (yes, computer tool available in beta). GPT (OpenAI): - Current models: GPT-5.4 (flagship), GPT-5.4-mini, GPT-5.4-nano (frontier); GPT-5.4 Pro for max performance. - Provider tools: Web search (yes, improved agentic web search), Code interpreter (yes, via Codex and API), Computer use (yes, native state-of-the-art computer-use capabilities). Gemini (Google): - Current models: Gemini 3.1 Pro (latest for complex tasks), Gemini 3.1 Flash-Lite (fastest). - Provider tools: Web search (yes, Grounding with Google Search), Code interpreter (yes, code execution tool with Python), Computer use (not explicitly confirmed in sources; strong agentic/coding support but no direct computer use tool mentioned).

Citations:


Update model names and versions to match current provider documentation.

The table contains outdated or incorrect model identifiers that no longer align with current offerings as of April 2026:

  • claude-3-haiku and claude-3-5-haiku should be claude-haiku-4.5
  • claude-opus-4-6 should be updated to claude-opus-4.7 (current flagship; 4.6 may still be available but migration is recommended)
  • gpt-3.5-turbo is significantly outdated; current models are gpt-5.4, gpt-5.4-mini, and gpt-5.4-nano
  • gemini-3-pro should be gemini-3.1-pro; gemini-lite should be gemini-3.1-flash-lite

The tool support matrix itself is accurate, but using stale model names undermines the technical credibility of the post, especially for a blog published in April 2026.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/blog/type-safe-provider-tools-tanstack-ai.md` around lines 23 - 31,
Update the outdated model identifiers in the table: replace `claude-3-haiku` and
`claude-3-5-haiku` with `claude-haiku-4.5`, change `claude-opus-4-6` to
`claude-opus-4.7`, replace `gpt-3.5-turbo` with the current GPT lineup entries
(`gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`) (you can list them as separate rows
or comma-separated under the Model column), and change `gemini-3-pro` to
`gemini-3.1-pro` and `gemini-lite` to `gemini-3.1-flash-lite`; keep the Provider
tools supported column values unchanged for each corresponding model entry so
the tool support matrix remains accurate.

@tannerlinsley tannerlinsley merged commit c3ccc2d into TanStack:main Apr 22, 2026
4 checks passed
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.

2 participants