Skip to content

Schema validation error with Google/Gemini models #8036

Closed

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.

Activity

  1. github-actions commented on Jan 12, 2026

    @github-actions
    Contributor

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

    Both issues describe the same root cause - the memory_rate_memory tool has numeric enum values [-1, 0, 1] for the rating parameter, but Google/Gemini (and anti-gravity) models require enum values to be strings instead. The error messages are identical.

    Feel free to ignore if this is a different use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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