Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dannykopping
Copy link
Collaborator

@dannykopping dannykopping commented Dec 23, 2025

This change adds an early return in injectTools() when there are no
tools to inject from MCP, preventing unnecessary modification of the
tool_choice parameter. Previously, disable_parallel_tool_use was set
even when no tools were injected, which was incorrect behaviour.

This change adds an early return in injectTools() when there are no
tools to inject from MCP, preventing unnecessary modification of the
tool_choice parameter. Previously, disable_parallel_tool_use was set
even when no tools were injected, which was incorrect behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Collaborator Author

dannykopping commented Dec 23, 2025

Copy link

@ssncferreira ssncferreira left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor comments 🍰

Comment on lines +157 to +158
// Tools are still injected.
require.Len(t, i.req.Tools, 1)

Choose a reason for hiding this comment

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

Not sure I fully understand this case. The AI client sends a request with tool_choice: none, telling Anthropic to not execute any tools. But AIBridge still injects the tools even though Anthropic will never execute them, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question! We don't conditionally inject tools based on tool choice right now. Maybe we should...

I'm in favour of not trying to be too clever / efficient here because this behaviour might confuse us / an operator looking at request logs. It might not be immediately apparently that tools didn't inject for this reason.

@dannykopping dannykopping merged commit 60ff22b into main Dec 24, 2025
2 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