Skip to content

fix(anthropic): keep tools array when toolChoice is 'none'#12609

Closed
giulio-leone wants to merge 2 commits intovercel:mainfrom
giulio-leone:fix/issue-12378-tool-choice-none-keep-tools
Closed

fix(anthropic): keep tools array when toolChoice is 'none'#12609
giulio-leone wants to merge 2 commits intovercel:mainfrom
giulio-leone:fix/issue-12378-tool-choice-none-keep-tools

Conversation

@giulio-leone
Copy link
Copy Markdown

Fixes #12378

Problem

When toolChoice is 'none', the Anthropic provider strips both tools and tool_choice from the API request. This causes empty content response when conversation history contains tool_use/tool_result blocks.

Fix

  • Changed 'none' case to return tools array and toolChoice: { type: 'none' } instead of undefined for both
  • Added 'none' to AnthropicToolChoice type union
  • Updated tests

@giulio-leone giulio-leone force-pushed the fix/issue-12378-tool-choice-none-keep-tools branch from 6863fa0 to 744adcd Compare February 14, 2026 21:05
@giulio-leone giulio-leone force-pushed the fix/issue-12378-tool-choice-none-keep-tools branch from 744adcd to 91236b1 Compare February 28, 2026 14:42
@giulio-leone
Copy link
Copy Markdown
Author

Intervention note for this PR:

Current blocker appears to be Vercel deployment authorization, not code/test correctness.

Observed pattern:

  • Vercel check fails with: "Authorization required to deploy."
  • Other checks (e.g., Socket Security / Vercel Agent Review) are passing.

Recommended unblock sequence:

  1. Complete the Vercel Git authorization flow from the failing check link.
  2. Re-run checks on this PR.
  3. If Vercel passes, this PR should move forward with normal review.

If useful, I can follow up with a PR-by-PR status sweep after authorization is completed.

@giulio-leone
Copy link
Copy Markdown
Author

Ready for review — fixes Anthropic provider failing when toolChoice is 'none' by preserving the tools array. Includes regression test.

@giulio-leone
Copy link
Copy Markdown
Author

This PR is ready for review — all CI checks pass, no merge conflicts, and all review threads have been resolved. Ready to merge when approved. 🚀

@giulio-leone giulio-leone force-pushed the fix/issue-12378-tool-choice-none-keep-tools branch from 91236b1 to f81d6a2 Compare March 5, 2026 20:43
@giulio-leone
Copy link
Copy Markdown
Author

Hi! Gentle ping — this PR is rebased on main, CI passes, and ready for review. Happy to address any feedback. Thanks!

@giulio-leone
Copy link
Copy Markdown
Author

Closing to reduce PR volume. Happy to resubmit if useful.

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.

anthropic provider: toolChoice 'none' strips tools from request, causing empty response with tool_use history

1 participant