Summary
convertConstToEnum() turns every const into enum: [value], including boolean and number constants. Gemini accepts only string enum values, so any request that carries a tool with const: true / const: false (common in discriminated unions from MCP tools) is rejected with HTTP 400 before the model runs.
Error
Invalid value at 'request.tools[0].function_declarations[194].parameters.properties[0].value.items.any_of[0].properties[12].value.enum[0]' (TYPE_STRING), false
Invalid value at 'request.tools[0].function_declarations[195].parameters.properties[0].value.items.one_of[0].properties[10].value.properties[0].value.enum[0]' (TYPE_STRING), true
... (18 lines like this per request)
Status: 400
Every request with the full tool set fails, so the model is unusable as a subagent until the offending tools are removed.
Where
packages/opencode/src/plugin/request-helpers.ts, convertConstToEnum() on main:
if (key === 'const' && !schema.enum) {
result.enum = [value] // value may be boolean or number
}
Repro
Any tool whose JSON schema contains { "const": false } (or true, or a number), for example:
{ "type": "object", "properties": { "flag": { "const": false } } }
sent to google/antigravity-gemini-3.8-flash (effective gemini-3.8-flash-high).
Suggested fix
Convert only string constants, and leave non-string const without an enum (Gemini keeps the declared type):
if (key === 'const' && !schema.enum) {
if (typeof value === 'string') {
result.enum = [value]
}
}
I run this change locally on 2.2.1 and the same tool set is accepted.
Environment
@cortexkit/opencode-antigravity-auth 2.2.1 (latest on npm)
- OpenCode 1.18.31, Windows 11
Summary
convertConstToEnum()turns everyconstintoenum: [value], including boolean and number constants. Gemini accepts only string enum values, so any request that carries a tool withconst: true/const: false(common in discriminated unions from MCP tools) is rejected with HTTP 400 before the model runs.Error
Every request with the full tool set fails, so the model is unusable as a subagent until the offending tools are removed.
Where
packages/opencode/src/plugin/request-helpers.ts,convertConstToEnum()onmain:Repro
Any tool whose JSON schema contains
{ "const": false }(ortrue, or a number), for example:{ "type": "object", "properties": { "flag": { "const": false } } }sent to
google/antigravity-gemini-3.8-flash(effectivegemini-3.8-flash-high).Suggested fix
Convert only string constants, and leave non-string
constwithout an enum (Gemini keeps the declared type):I run this change locally on 2.2.1 and the same tool set is accepted.
Environment
@cortexkit/opencode-antigravity-auth2.2.1 (latest on npm)