From f6bbca35ab7c50fa9384748551723f0394abeb18 Mon Sep 17 00:00:00 2001 From: Muran-prog Date: Sat, 14 Mar 2026 21:18:06 +0200 Subject: [PATCH 1/2] fix: strip uniqueItems from Gemini function_declarations (#2123) Gemini API rejects uniqueItems in tool schemas with 400. Add it to unsupportedConstraints alongside minItems/maxItems where it belongs. Same class of fix as #1424 and #1531. --- internal/util/gemini_schema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/util/gemini_schema.go b/internal/util/gemini_schema.go index 8617b846..c2a4474d 100644 --- a/internal/util/gemini_schema.go +++ b/internal/util/gemini_schema.go @@ -236,7 +236,7 @@ func addAdditionalPropertiesHints(jsonStr string) string { var unsupportedConstraints = []string{ "minLength", "maxLength", "exclusiveMinimum", "exclusiveMaximum", - "pattern", "minItems", "maxItems", "format", + "pattern", "minItems", "maxItems", "uniqueItems", "format", "default", "examples", // Claude rejects these in VALIDATED mode } From 152c310bb74dd99d8cfeb844af63f2c345e3995f Mon Sep 17 00:00:00 2001 From: Muran-prog Date: Sat, 14 Mar 2026 21:22:14 +0200 Subject: [PATCH 2/2] test: add uniqueItems stripping test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers the fix from the previous commit — verifies uniqueItems is removed from the schema and moved to the description hint. --- internal/util/gemini_schema_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/internal/util/gemini_schema_test.go b/internal/util/gemini_schema_test.go index bb06e956..92bce013 100644 --- a/internal/util/gemini_schema_test.go +++ b/internal/util/gemini_schema_test.go @@ -1046,3 +1046,27 @@ func TestRemoveExtensionFields(t *testing.T) { }) } } + +// uniqueItems should be stripped and moved to description hint (#2123). +func TestCleanJSONSchemaForAntigravity_UniqueItemsStripped(t *testing.T) { + input := `{ + "type": "object", + "properties": { + "ids": { + "type": "array", + "description": "Unique identifiers", + "items": {"type": "string"}, + "uniqueItems": true + } + } + }` + + result := CleanJSONSchemaForAntigravity(input) + + if strings.Contains(result, `"uniqueItems"`) { + t.Errorf("uniqueItems should be removed from schema") + } + if !strings.Contains(result, "uniqueItems: true") { + t.Errorf("uniqueItems hint missing in description") + } +}