Gemini tool calls format causing AI_APICallError #753

Closed
opened 2026-02-16 17:28:08 -05:00 by yindo · 4 comments
Owner

Originally created by @jeanmatthieu on GitHub (Jul 16, 2025).

Originally assigned to: @thdxr on GitHub.

Hello,

Using Gemini 2.5 Pro I'm getting an AI_APICallError error every message I send to the LLM.

This is the error I got from my proxy

{"message":"Failed to parse request: failed to parse request: proto: syntax error (line 1:13263): unexpected token {","request_id":"5f","details":"failed to parse request: proto: syntax error (line 1:13263): unexpected token {"}

Looking at the payload and response from my proxy it seems that tools are passed as a dictionary and perhaps my proxy expects an array ?
This is what is sent by opencode

{
"tools": 
    {
      "functionDeclarations": [
        {
          "name": string,
          "description": string,
          "parameters": {
            object (OpenAPI Object Schema)
          }
        }
      ]
    }
  ,
}

while https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/function-calling suggests tools should be an array such as

"tools": [
    {
      "functionDeclarations": [
        {
          "name": string,
          "description": string,
          "parameters": {
            object (OpenAPI Object Schema)
          }
        }
      ]
    }
  ],

But I dont know if this is an issue in opencode or if my proxy that should handle both use case so I decided to report it here first.

Thank you !

Originally created by @jeanmatthieu on GitHub (Jul 16, 2025). Originally assigned to: @thdxr on GitHub. Hello, Using Gemini 2.5 Pro I'm getting an `AI_APICallError` error every message I send to the LLM. This is the error I got from my proxy ``` {"message":"Failed to parse request: failed to parse request: proto: syntax error (line 1:13263): unexpected token {","request_id":"5f","details":"failed to parse request: proto: syntax error (line 1:13263): unexpected token {"} ``` Looking at the payload and response from my proxy it seems that `tools` are passed as a dictionary and perhaps my proxy expects an array ? This is what is sent by `opencode` ``` { "tools": { "functionDeclarations": [ { "name": string, "description": string, "parameters": { object (OpenAPI Object Schema) } } ] } , } ``` while https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/function-calling suggests `tools` should be an array such as ``` "tools": [ { "functionDeclarations": [ { "name": string, "description": string, "parameters": { object (OpenAPI Object Schema) } } ] } ], ``` But I dont know if this is an issue in `opencode` or if my proxy that should handle both use case so I decided to report it here first. Thank you !
yindo closed this issue 2026-02-16 17:28:08 -05:00
Author
Owner

@jeanmatthieu commented on GitHub (Jul 21, 2025):

Hi @necaris, thanks I have tied with version 0.3.46 and the issue still occurs on my end.

@jeanmatthieu commented on GitHub (Jul 21, 2025): Hi @necaris, thanks I have tied with version 0.3.46 and the issue still occurs on my end.
Author
Owner

@martinffx commented on GitHub (Aug 4, 2025):

yes, also seem to be running into this. Gemini does not seem to be able to use my MCP Tools?

@martinffx commented on GitHub (Aug 4, 2025): yes, also seem to be running into this. Gemini does not seem to be able to use my MCP Tools?
Author
Owner

@necaris commented on GitHub (Aug 4, 2025):

Please see #1232 -- this is due to limitations in the Gemini API, so when MCP tools (or builtin ones) use JSON Schema elements that Gemini doesn't support, everything falls over.

@necaris commented on GitHub (Aug 4, 2025): Please see #1232 -- this is due to limitations in the Gemini API, so when MCP tools (or builtin ones) use JSON Schema elements that Gemini doesn't support, everything falls over.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#753