Skip to content

fix(gemini): prevent gemini incompatibility with some tools#31877

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
Killusions:fix/prevent-gemini-incompatibility-with-some-tools-in-gemini
Jun 11, 2026
Merged

fix(gemini): prevent gemini incompatibility with some tools#31877
rekram1-node merged 1 commit into
anomalyco:devfrom
Killusions:fix/prevent-gemini-incompatibility-with-some-tools-in-gemini

Conversation

@Killusions

@Killusions Killusions commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #19276

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes a type schema incompatibility with Gemini and some tools/MCPs (occured through GitHub Copilot).

How did you verify your code works?

Tested locally.

Screenshots / recordings

None

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potentially related PR:

Related PR:

This PR appears related as it also addresses Gemini schema issues. While #31877 focuses on preventing Gemini incompatibility with tools, PR #27641 specifically handles sanitizing Gemini schema references, which could be addressing a similar underlying compatibility problem with Gemini's type schema handling.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Killusions Killusions force-pushed the fix/prevent-gemini-incompatibility-with-some-tools-in-gemini branch from 2ed7b0d to 99504d1 Compare June 11, 2026 11:43
@max-wittig

Copy link
Copy Markdown

Looks nice! Is this something you could look at to get Gemini working with opencode? @thdxr

@rekram1-node

Copy link
Copy Markdown
Collaborator

I don't think this matches how ai-sdk/google behaves

@rekram1-node

Copy link
Copy Markdown
Collaborator
The PR comment says plain @ai-sdk/google “rewrites these,” but the PR does not implement the same rewrite.
@ai-sdk/google converts:
{ "type": ["number", "string"] }
into:
{
  "anyOf": [
    { "type": "number" },
    { "type": "string" }
  ]
}
The PR converts it into:
{ "type": "number" }
It simply keeps the first non-null type, losing "string".

@Killusions Killusions force-pushed the fix/prevent-gemini-incompatibility-with-some-tools-in-gemini branch from 99504d1 to 35581b1 Compare June 11, 2026 15:45
@Killusions

Copy link
Copy Markdown
Contributor Author

@rekram1-node tried to align it more to how the adapter works

@rekram1-node

rekram1-node commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

@Killusions thx, also do u mind adding a test case for this by chance? Im sure there are prolly some more cases we need to handle better too but for now just adding a new test will be nice

Some MCPs fail with Gemini
(at least via GitHub Copilot)

Close anomalyco#19276
@Killusions Killusions force-pushed the fix/prevent-gemini-incompatibility-with-some-tools-in-gemini branch from 35581b1 to 612607c Compare June 11, 2026 15:59
@Killusions

Copy link
Copy Markdown
Contributor Author

@rekram1-node Added one

@rekram1-node rekram1-node merged commit 2e71292 into anomalyco:dev Jun 11, 2026
8 checks passed
@max-wittig

Copy link
Copy Markdown

Amazing! Thank you very much for all the work you're doing here!

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.

Gemini 3.1 Pro API returns 400 error due to tool schema incompatibility

3 participants