Schema validation error with Google/Gemini models #4973

Closed
opened 2026-02-16 17:47:11 -05:00 by yindo · 0 comments
Owner

Originally created by @zensi-dev on GitHub (Jan 12, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using OpenCode with Google Gemini models, I'm encountering a 400 validation error related to the memory_rate_memory tool's schema.

Error Message

Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[0]' (TYPE_STRING), -1
Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[1]' (TYPE_STRING), 0
Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[2]' (TYPE_STRING), 1

Details

The memory_rate_memory tool (from the mcp-memory-service MCP server) defines its rating parameter with numeric enum values:

"rating": {
  "description": "Quality rating: -1 (thumbs down), 0 (neutral), 1 (thumbs up)",
  "type": "number",
  "enum": [-1, 0, 1]
}

When OpenCode passes this tool definition to the Google/Gemini API, the API rejects it with a 400 error, indicating it expects string enum values instead of numeric ones.

Context

  • mcp-memory-service is a popular, actively maintained MCP server (1.1k+ stars, Apache 2.0 licensed)
  • It's compatible with 13+ AI applications including Claude Desktop, Claude Code, VS Code, Cursor, etc.
  • The tool appears to work correctly with other model providers (OpenAI, Anthropic, etc.)
  • This issue appears specific to Google/Gemini's stricter API validation requirements

Environment

  • OpenCode version: latest
  • Model: gemini-3-pro-low
  • Platform: Linux

Additional Context

The error occurs when trying to use tools from mcp-memory-service with Google Gemini models in OpenCode. Other model providers seem to accept the same tool schema without issues.

Originally created by @zensi-dev on GitHub (Jan 12, 2026). Originally assigned to: @thdxr on GitHub. ## Description When using OpenCode with Google Gemini models, I'm encountering a 400 validation error related to the `memory_rate_memory` tool's schema. ## Error Message ``` Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[0]' (TYPE_STRING), -1 Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[1]' (TYPE_STRING), 0 Invalid value at 'request.tools[0].function_declarations[33].parameters.properties[1].value.enum[2]' (TYPE_STRING), 1 ``` ## Details The `memory_rate_memory` tool (from the mcp-memory-service MCP server) defines its `rating` parameter with numeric enum values: ```json "rating": { "description": "Quality rating: -1 (thumbs down), 0 (neutral), 1 (thumbs up)", "type": "number", "enum": [-1, 0, 1] } ``` When OpenCode passes this tool definition to the Google/Gemini API, the API rejects it with a 400 error, indicating it expects string enum values instead of numeric ones. ## Context - **mcp-memory-service** is a popular, actively maintained MCP server (1.1k+ stars, Apache 2.0 licensed) - It's compatible with 13+ AI applications including Claude Desktop, Claude Code, VS Code, Cursor, etc. - The tool appears to work correctly with other model providers (OpenAI, Anthropic, etc.) - This issue appears specific to Google/Gemini's stricter API validation requirements ## Environment - OpenCode version: latest - Model: gemini-3-pro-low - Platform: Linux ## Additional Context The error occurs when trying to use tools from mcp-memory-service with Google Gemini models in OpenCode. Other model providers seem to accept the same tool schema without issues.
yindo closed this issue 2026-02-16 17:47:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4973