fix: transform MCP tool schemas for Google/Gemini compatibility#4538
Merged
Conversation
- Apply ProviderTransform.schema() to MCP tools to convert integer enums to strings - Convert function declaration to arrow function for strict mode compliance - Fix variable shadowing in content iteration loop Resolves 'Invalid value at tools.function_declarations' error when using Google/Gemini with MCP tools that have integer enum parameters.
github-actions
Bot
force-pushed
the
dev
branch
3 times, most recently
from
November 22, 2025 18:07
f1dc981 to
3e15a39
Compare
github-actions
Bot
force-pushed
the
dev
branch
2 times, most recently
from
November 22, 2025 18:21
df8bdf9 to
0dd5039
Compare
Collaborator
|
We need this but I tested with several providers and this does not work correctly. Your changes will basically delete the input schema entirely I'd recommend not using type error silencing because it is going to make code harder to maintain. |
Contributor
Author
|
Fixed. I have tested it with grok, anthropic, gemini etc. |
Collaborator
|
This looks good ill test more tmr just to be sure. We used to sanitize the tools way better before we did the zodv4 migration and then we kinda just forgot about it ig: |
xywsxp
pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Rwanbt
pushed a commit
to Rwanbt/opencode
that referenced
this pull request
May 5, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Rwanbt
pushed a commit
to Rwanbt/opencode
that referenced
this pull request
Jun 14, 2026
…alyco#4538) Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: Github Action <action@github.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves 'Invalid value at tools.function_declarations' error when using
Google/Gemini with MCP tools that have integer enum parameters.
Closes: #4512