From 267859ddb56bff737d4310e98df040e7bd33f049 Mon Sep 17 00:00:00 2001 From: n24q02m Date: Thu, 5 Mar 2026 09:22:01 +0700 Subject: [PATCH 1/2] fix(gemini): strip `deprecated` keyword from tool schemas sent to Gemini API Gemini API rejects function declarations containing the JSON Schema `deprecated` keyword with INVALID_ARGUMENT. Claude Code and other clients include this field in their tool definitions, causing 400 errors on Antigravity/Gemini routes. Add `deprecated` to the unsupported keywords list in removeUnsupportedKeywords() so it is stripped before forwarding. --- internal/util/gemini_schema.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/util/gemini_schema.go b/internal/util/gemini_schema.go index b8d07bf4d9..e0caab8222 100644 --- a/internal/util/gemini_schema.go +++ b/internal/util/gemini_schema.go @@ -431,6 +431,7 @@ func removeUnsupportedKeywords(jsonStr string) string { "$schema", "$defs", "definitions", "const", "$ref", "$id", "additionalProperties", "propertyNames", "patternProperties", // Gemini doesn't support these schema keywords "enumTitles", "prefill", // Claude/OpenCode schema metadata fields unsupported by Gemini + "deprecated", // JSON Schema keyword not supported by Gemini API ) deletePaths := make([]string, 0) From fafa1d155d9d901d768d6d640de5675d82c74346 Mon Sep 17 00:00:00 2001 From: n24q02m Date: Thu, 5 Mar 2026 09:27:55 +0700 Subject: [PATCH 2/2] test(gemini): add test for deprecated keyword removal Verify that `deprecated` field is stripped from tool schemas while preserving properties named "deprecated" as legitimate field names. --- internal/util/gemini_schema_test.go | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/internal/util/gemini_schema_test.go b/internal/util/gemini_schema_test.go index bb06e95673..d8f318c3bd 100644 --- a/internal/util/gemini_schema_test.go +++ b/internal/util/gemini_schema_test.go @@ -921,6 +921,38 @@ func TestCleanJSONSchemaForGemini_RemovesGeminiUnsupportedMetadataFields(t *test compareJSON(t, expected, result) } +func TestCleanJSONSchemaForGemini_RemovesDeprecatedField(t *testing.T) { + input := `{ + "type": "object", + "properties": { + "old_field": { + "type": "string", + "deprecated": true + }, + "deprecated": { + "type": "string", + "description": "property named deprecated should not be removed" + } + } + }` + + expected := `{ + "type": "object", + "properties": { + "old_field": { + "type": "string" + }, + "deprecated": { + "type": "string", + "description": "property named deprecated should not be removed" + } + } + }` + + result := CleanJSONSchemaForGemini(input) + compareJSON(t, expected, result) +} + func TestRemoveExtensionFields(t *testing.T) { tests := []struct { name string