Bug
When a tool input is declared as a nullable array (type: ["null", "array"]), @ai-sdk/google's convertJSONSchemaToOpenAPISchema splits it into anyOf: [{ type: "array" }] but leaves a sibling items field dangling at the parent level.
Gemini rejects the resulting function declaration because items sits outside the array branch, producing a schema error for any tool whose input is a nullable array.
Impact
Any opencode tool whose input schema contains type: ["null", "array"] fails against Google Gemini (@ai-sdk/google / @ai-sdk/google-vertex).
Suggested fix
Before sending the request, fold the sibling items into the array-typed branches of any union (anyOf/oneOf/allOf) so the generated function declaration carries items inside the array branch. See packages/opencode/src/session/llm/request.ts.
Bug
When a tool input is declared as a nullable array (
type: ["null", "array"]),@ai-sdk/google'sconvertJSONSchemaToOpenAPISchemasplits it intoanyOf: [{ type: "array" }]but leaves a siblingitemsfield dangling at the parent level.Gemini rejects the resulting function declaration because
itemssits outside the array branch, producing a schema error for any tool whose input is a nullable array.Impact
Any opencode tool whose input schema contains
type: ["null", "array"]fails against Google Gemini (@ai-sdk/google/@ai-sdk/google-vertex).Suggested fix
Before sending the request, fold the sibling
itemsinto the array-typed branches of any union (anyOf/oneOf/allOf) so the generated function declaration carriesitemsinside the array branch. Seepackages/opencode/src/session/llm/request.ts.