Skip to content

Schema validation error with Google/Gemini models #8036

@zensi-dev

Description

@zensi-dev

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions