MCPcopy Index your code
hub / github.com/simstudioai/sim / cleanSchemaForGemini

Function cleanSchemaForGemini

apps/sim/providers/google/utils.ts:60–76  ·  view source on GitHub ↗
(schema: SchemaUnion)

Source from the content-addressed store, hash-verified

58 * Removes additionalProperties from a schema object (not supported by Gemini)
59 */
60export function cleanSchemaForGemini(schema: SchemaUnion): SchemaUnion {
61 if (schema === null || schema === undefined) return schema
62 if (typeof schema !== 'object') return schema
63 if (Array.isArray(schema)) {
64 return schema.map((item) => cleanSchemaForGemini(item))
65 }
66
67 const cleanedSchema: Record<string, unknown> = {}
68 const schemaObj = schema as Record<string, unknown>
69
70 for (const key in schemaObj) {
71 if (key === 'additionalProperties') continue
72 cleanedSchema[key] = cleanSchemaForGemini(schemaObj[key] as SchemaUnion)
73 }
74
75 return cleanedSchema
76}
77
78/**
79 * Extracts text content from a Gemini response candidate.

Callers 3

buildNextConfigFunction · 0.90
executeGeminiRequestFunction · 0.90
convertToGeminiFormatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected