toGeminiToolSchema
function toGeminiToolSchema(node): Record<string, unknown>;Defined in: core/src/schema.ts:226
A JSON Schema for Gemini’s parametersJsonSchema and responseJsonSchema, which take
standard JSON Schema. It is sent as written except for the four shapes the API refuses.
Measured on gemini-3.8-flash on 2026-10-21, in a tool and as a response schema alike;
every other keyword tried ($ref, $defs, oneOf, allOf, not, if, const, numeric
enum, type: [..., "null"], patternProperties, additionalProperties, arrays without
items) came back accepted:
requirednames a property that is not declared, at any depth: 400 “requires unspecified property”. The names with no property are dropped.- Draft-04
exclusiveMinimum: true(orfalse): 400 “must be a number”. It becomes the number form,exclusiveMinimum: <minimum>, andminimumgoes. - A tuple,
items: [a, b]: 400 “must be a boolean or an object”. It becomesprefixItems, andadditionalItemsbecomesitems, as in 2020-12. - A recursive
$refthat is not behind an optional property or an array that may be empty: 400 “ref loops are only supported if …”. The self-reference becomes{}.
This replaced a sanitizer written for the older parameters field, which accepts a small
OpenAPI subset. Kept on parametersJsonSchema, it turned a numeric enum into a string enum
(the model then sent "2" for 2), forced string items onto an array of anything, and
dropped every $ref, while still sending the 400s above.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
node |
unknown |
Returns
Section titled “Returns”Record<string, unknown>