You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
toGeminiSchema drops type on JSON Schema nullable type arrays (type: ["string", "null"]), causing 400 on Gemini tool calls #44
When a tool parameter uses a JSON Schema draft-07 / 2020-12 nullable type array such as type: ["string", "null"] (or ["integer", "null"], ["boolean", "null"], etc.), toGeminiSchema in packages/core/src/transform/gemini.ts checks typeof inputSchema.type === 'string'. Because inputSchema.type is an array, schemaType evaluates to undefined and the emitted Gemini schema drops type completely while keeping description / enum / properties.
OpenCode 2.x built-in and MCP tools emit nullable parameters in this form (for example planId: { type: ["string", "null"] }). When sent to Cloud Code for Gemini models (antigravity-gemini-3.8-flash, antigravity-gemini-4-argon), the request fails with HTTP 400 INVALID_ARGUMENT due to the typeless parameter definition.
Reproduction
Input tool schema property:
{
"type": ["string", "null"],
"description": "The plan a note or todo belongs to; null unlinks"
}
Current toGeminiSchema output (missing type and nullable):
{
"description": "The plan a note or todo belongs to; null unlinks"
}
Expected toGeminiSchema output:
{
"type": "STRING",
"nullable": true,
"description": "The plan a note or todo belongs to; null unlinks"
}
Fix
Normalize single-type nullable arrays (["string", "null"], ["null", "integer"], single-element ["string"], ["null"], and case/duplicate variants) into { type: "<non-null>", nullable: true } before reading inputSchema.type, while leaving multi-type unions (["string", "number"]) untouched for existing validation.
Activity
agauth-alfonso commentedon Oct 26, 2026
Thanks for the clear report and the fix PR. We're reproducing it against the current code and will reply here with the result.