Skip to content

Gemini: all requests fail due to anyOf schema in github_create_pull_request_review tool #14509

@IamCooller

Description

@IamCooller

Bug Report

Description

When using Gemini as the AI provider in OpenCode, every request fails with the following error:

Unable to submit request because `github_create_pull_request_review` functionDeclaration
`parameters.comments` schema specified other fields alongside any_of.
When using any_of, it must be the only field set.
Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling

Root Cause

Gemini API validates all tool schemas before processing any request.
The github_create_pull_request_review tool from @modelcontextprotocol/server-github
defines the comments parameter with anyOf combined with other fields (e.g. type, description, items).

Gemini strictly requires that when anyOf is used, it must be the only field in the schema object. No sibling fields allowed.

Impact

  • ANY request to Gemini fails — not just GitHub-related ones
  • The error appears even for simple questions like "hello"
  • Makes Gemini completely unusable when the GitHub MCP server is enabled

Workaround

Disable the GitHub MCP server in opencode.json:

"github": {
  "enabled": false
}

Expected Fix

OpenCode should sanitize tool schemas before sending them to Gemini. When a schema uses anyOf, strip all sibling fields:

// Before (breaks Gemini):
{ type: 'array', anyOf: [...], description: '...' }

// After (Gemini-compatible):
{ anyOf: [...] }

Reference: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling

Environment

  • OpenCode with Gemini provider (via opencode-gemini-auth plugin)
  • GitHub MCP: @modelcontextprotocol/server-github
  • Platform: macOS

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions