fix(openai): apply strict fallback in the provider-path function-tool converter#790
Conversation
… converter The provider tool dispatcher (convertToolsToProviderFormat) routes MCP and function tools through convertFunctionToolToAdapterFormat, which still forced strict:true and 400'd on schemas outside OpenAI's strict subset (e.g. Notion MCP tools using $defs/oneOf). Apply the same isStrictModeCompatible check used by the responses/chat-completions converters: emit strict:false and strip unsupported formats when the schema can't be strict, keeping the tool callable.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthrough
ChangesOpenAI strict-mode fallback for function tool converter
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🚀 Changeset Version Preview1 package(s) bumped directly, 3 bumped as dependents. 🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit 4158201
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-mcp
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
…ema fix Bump @tanstack/ai-openai 0.14.4 → 0.15.2 (pins @tanstack/openai-base 0.8.7, TanStack/ai#790) and @tanstack/ai → 0.32.0. 0.8.7 emits strict:false for tool schemas outside OpenAI's strict subset in the provider-path function-tool converter, so MCP tools (e.g. Notion's API-post-search) no longer 400 — no local patch needed. Verified end-to-end against the live Slack bot.
Follow-up to #786.
#786 added the
strict:falsefallback toresponses-tool-converter.tsandchat-completions-tool-converter.ts, but the adapter's provider tool dispatcher (convertToolsToProviderFormat) routes MCP and function tools through a third converter —convertFunctionToolToAdapterFormatintools/function-tool.ts— which still forcedstrict: true. So tools whose schema is outside OpenAI's strict subset (e.g. Notion MCP tools using$defs/oneOf) still 400'd the whole request.This applies the same
isStrictModeCompatiblecheck there: emitstrict: falseand strip unsupported formats when the schema can't be expressed under strict Structured Outputs, keeping the tool callable.Verified end-to-end: a TanStack
chat()with the Notion + Linear MCP servers now completes (previously 400'd onAPI-get-user).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
formatentries.