sanitizeGeminiToolSchema
sanitizeGeminiToolSchema<
T>(schema):T
Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/providers/geminiSchemaSanitizer.ts:294
Pure, recursive normaliser: returns a cleaned DEEP COPY of a JSON-Schema containing only keywords
Gemini’s function-declaration Schema accepts, so its OpenAPI-3.0 subset accepts the tool. At each
node the SAFE composition keywords are first RESOLVED into supported equivalents
(resolveComposition: const → enum, clean allOf → shallow merge) and only then does the
allowlist drop the rest. Does not mutate the input. anyOf unions survive; $ref/oneOf/not are
dropped (see resolveComposition for why the last three are deferred, not resolved).
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”schema
Section titled “schema”T
Returns
Section titled “Returns”T