opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Error with Gemini models when MCP enabled

Open shettydev opened this issue 5 days ago • 5 comments

Description

Unable to use opencode with any gemin models. Tried updating the API key multiple times, but that doesn't seem to be the root cause. Since the same API keys are woring in other apps. Not sure what the issue is?

OpenCode version

1.0.174

Steps to reproduce

  1. Enable MCP
  2. Select any Gemini model before starting the conversation

Screenshot and/or share link

Image

This is the error block:

* GenerateContentRequest.tools[0].function_declarations[21].parameters.properties[nodes].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[21].parameters.properties[edges].items: missing field.

Operating System

macOS 26.1

Terminal

Ghostty, Tmux

shettydev avatar Dec 20 '25 09:12 shettydev

This issue might be a duplicate of existing issues. Please check:

  • #4665: OpenCode plus Zen Gemini 3 Pro model causes errors (similar GenerateContentRequest validation errors with Gemini)
  • #3140: AI_APICallError with function declarations parameters on Gemini API (exact same schema validation error pattern)
  • #4832: Gemini 3 Pro function calling fails - missing thoughtSignature support (related to Gemini function calling issues)
  • #365: [bug] google provider not running due to tool call schema mismatches (broader Gemini schema mismatch issue)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 20 '25 09:12 github-actions[bot]

Looks like the issue was specific to the MCP configuration. I disabled all my MCPs (which were only 3) from ~/.config/opencode/opencode.json and tried using the Gemini model,s and it worked fine.

Although I am curious whether there is any fix for this?

shettydev avatar Dec 20 '25 10:12 shettydev

ur mcp server isnt compatible w gemini api, now we do some transforms to make the tools compliant but there is a case we arent handling, what mcp causes this?

rekram1-node avatar Dec 20 '25 20:12 rekram1-node

I found the MCP, which is causing this issue:

{
  "$schema": "https://opencode.ai/config.json",
  ...
  "mcp": {
    ...
    "basic-memory": { 
      "type": "local",
      "command": ["basic-memory", "mcp"],
      "enabled": true
    }
  }
}

shettydev avatar Dec 21 '25 10:12 shettydev

okay ill try to make transform more robust for that case

rekram1-node avatar Dec 21 '25 17:12 rekram1-node