Skip to content

Gemini API rejects JSON Schema containing $ref references #12295

Description

@high726

Problem

Gemini API rejects schemas containing $ref alongside other fields, causing errors like:

$ref 'QuestionOption' was set alongside unsupported fields. 
If a schema node has $ref set, then only description and default can be set alongside it

This happens when MCP tools use JSON Schema with $ref references to $defs/definitions.

Expected Behavior

OpenCode should expand $ref references before sending schemas to Gemini API.

Related Issues

Related PRs

Activity

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

Metadata

Metadata

Assignees

Labels

zenRelates to Zen

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions