[PR #1132] [MERGED] feat(provider): add Gemini tool schema sanitization #9823

Closed
opened 2026-02-16 18:14:13 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1132
Author: @necaris
Created: 7/18/2025
Status: Merged
Merged: 7/18/2025
Merged by: @thdxr

Base: devHead: work-around-gemini-tool-quirks


📝 Commits (1)

  • 33abac2 feat(provider): add Gemini tool schema sanitization

📊 Changes

1 file changed (+58 additions, -1 deletions)

View changed files

📝 packages/opencode/src/provider/provider.ts (+58 -1)

📄 Description

This PR introduces a new function, sanitizeGeminiParameters, to recursively sanitize Zod schemas for tools being sent to Google's Gemini models. This is necessary to work around limitations in the Gemini API.

The implementation is a Zod-native equivalent of the logic found in the official Gemini CLI.

This will likely close #977 and #1052 and related issues.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1132 **Author:** [@necaris](https://github.com/necaris) **Created:** 7/18/2025 **Status:** ✅ Merged **Merged:** 7/18/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `work-around-gemini-tool-quirks` --- ### 📝 Commits (1) - [`33abac2`](https://github.com/anomalyco/opencode/commit/33abac262dce12d1f942b1b73613351c248745f0) feat(provider): add Gemini tool schema sanitization ### 📊 Changes **1 file changed** (+58 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/provider/provider.ts` (+58 -1) </details> ### 📄 Description This PR introduces a new function, `sanitizeGeminiParameters`, to recursively sanitize Zod schemas for tools being sent to Google's Gemini models. This is necessary to work around limitations in the Gemini API. The implementation is a Zod-native equivalent of the [logic found in the official Gemini CLI][1]. [1]: https://github.com/google-gemini/gemini-cli/blob/9dadf2295804867d44628eda32fc1e46d80f9db3/packages/core/src/tools/tool-registry.ts#L360 This will likely close #977 and #1052 and related issues. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:13 -05:00
yindo closed this issue 2026-02-16 18:14:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9823