Skip to content

Documentation / @agentick/google / sanitizeSchemaForGemini

Function: sanitizeSchemaForGemini()

sanitizeSchemaForGemini(schema, depth?): any

Defined in: google.ts:529

Sanitize a JSON Schema for Gemini's function declaration format. Gemini supports a strict subset of JSON Schema. This recursively strips unsupported features while preserving the schema's intent.

Removed: $ref, additionalItems, additionalProperties (empty object), tuple-style items (array of schemas), $defs/$definitions. Simplified: anyOf/oneOf with mixed types → first valid option or any.

Parameters

schema

any

depth?

number = 0

Returns

any

Released under the ISC License.