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.
Thanks for the detailed report. We reproduced this on the current code. A small correction for the record: type isn't dropped. It's forwarded unchanged as the lowercase array ["string", "null"], which Gemini's Schema doesn't accept, so the request fails the way you describe. The same path also skips the array-default items, the structural-field filtering for object and array nodes, and the integer bound folding when the type is an array. We'll track the fix in #45.
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.
agauth-alfonso commentedon Oct 26, 2026
Thanks for the detailed report. We reproduced this on the current code. A small correction for the record:
typeisn't dropped. It's forwarded unchanged as the lowercase array["string", "null"], which Gemini'sSchemadoesn't accept, so the request fails the way you describe. The same path also skips the array-defaultitems, the structural-field filtering for object and array nodes, and the integer bound folding when the type is an array. We'll track the fix in #45.agauth-alfonso commentedon Oct 27, 2026
Fixed in 3.0.14 (https://github.com/cortexkit/antigravity-auth/releases/tag/v3.0.14) by #45: a JSON Schema type array such as
["string", "null"]is now sent to Gemini as the type plusnullable: true. Thanks again for the report and the fix.