Skip to content

Commit 3421716

Browse files
authored
fix(gemini): derive the items schema Gemini requires from a tuple-style array (#454)
* fix(gemini): derive the items schema Gemini requires from a tuple-style array A tool whose parameter is a fixed-shape array — `where: [field, operator, value]` written as `prefixItems` with no `items` — reached the Gemini backend as an array without `items`, which it rejects for the whole request: `GenerateContentRequest.tools[0].function_declarations[1] .parameters.properties[query].properties[where].items.items: missing field.` (400, seen through the antigravity provider on 2026-09-03). The schema sanitizer now gives every array schema an `items`: the tuple's positions become one schema — the single schema when they agree, `anyOf` over the distinct typed ones otherwise — and `prefixItems`, which has no Gemini counterpart, is dropped. A position with no `type` contributes nothing, since a typeless branch is the same missing-field failure one level down; an array that declares nothing about its elements is given string elements as a last resort so the request reaches the model at all. An array that already has `items` keeps it as written. * docs(research): note how reference bridges sanitize tool schemas for Gemini * chore(agent-memory): record that cubic -b skips uncommitted changes * fix(gemini): emit only typed element schemas and translate type lists for the Schema proto The `parameters` field is Gemini's `Schema` proto, where `type` is REQUIRED on every node, nullability is its own `nullable` field, and neither `prefixItems` nor a JSON `type` list exists. The first cut folded a heterogeneous tuple into `items: {anyOf: [...]}`, a node with no `type`, which is the shape Google's own bridges collapse rather than forward (google/adk-python#3424, googleapis/python-genai#1807), so the captured `[field, operator, value]` case would still have failed. - Tuple positions now collapse to one typed schema: the single schema when they agree, their shared `type` when they agree on that much, otherwise the first position's schema. Array positions keep a complete branch so the derived `items` never lacks its own `items`. - A position contributes its type directly, through `anyOf`/`oneOf` arms, or through an `enum` of uniformly typed values; a typeless position contributes nothing. - A `prefixItems`-only tuple (no `type`) is recognized as an array and gains `type: "array"` (cubic P2 on #454); draft-07 array-valued `items` is folded the same way and a boolean `items` is replaced. - A JSON `type` list becomes the scalar type plus `nullable: true`, mirroring CLIProxyAPI's flattenTypeArrays. - `properties`/`$defs`/`definitions` values are walked as schemas while their keys are left alone; `default`, `example(s)` and `enum` hold instances and are not walked. - The array fix runs after the child walk so folded positions are already sanitized. * fix(gemini): fall back to a nullable string for a null-only type list A JSON Schema `type` list naming only `"null"` was flattened to `type: "null"`. The generativelanguage v1beta proto lists a `NULL` member, but the Code Assist surface this provider talks to is unverified there and three reviewers flagged it as a likely 400, so the list now becomes `{"type":"string","nullable":true}` like every other nullable list. Test expectation updated to match. * fix(gemini): treat an untyped draft-07 tuple as an array and stop cloning tuple arms Apply two Gemini Code Assist review suggestions on #454: - is_array_schema also accepts an array-valued items when type is absent, so a draft-07 tuple that omits "type": "array" is folded into the single items schema Gemini requires instead of reaching the backend as an array-valued items it rejects. - collect_typed_branches consumes the owned position and moves its anyOf/oneOf arms out instead of cloning them. * fix(gemini): give a typeless element schema the type Gemini requires Apply the Codex review finding on #454: an object-valued items schema that declared no type returned early and reached the backend typeless, which the Schema proto rejects the same way it rejects a missing items. - A typeless element gets the type its enum or properties imply, and otherwise string, keeping the rest of the schema. - An element whose type lives only in anyOf/oneOf arms folds like a tuple of one position, reusing the branch derivation. - is_array_schema also recognizes an object-valued items, so a nested array that omits type is typed on its own pass instead of being declared a string by the parent's fallback. * fix(gemini): fold a trailing items schema with its tuple positions and document the adaptation Apply the Codex and cubic review findings on #454: - An untyped items beside prefixItems, or one whose type lives in anyOf/oneOf/allOf arms, is folded as one more tuple position instead of discarding the positions or gaining a contradicting fallback. - A position speaks through its type, its composition arms, or what its enum or properties imply, in that order; arms that name no type hand back to the position itself. - The Antigravity provider page and its ko/ja/zh-cn copies describe the tool-schema adaptation and its lossy fallbacks. * fix(gemini): keep property-keyed maps out of array detection and read compositions in order Apply the Codex and cubic review findings on #454: - dependentSchemas is walked by value like properties, dependentRequired is left alone, and draft-07 dependencies walks only its schema-valued entries, so a property named items under those maps is no longer read as the array keyword and folded into a string element. - A position carrying several composition keywords is read past a typeless one, and no further than the first that names a type, so arms that differ only in constraints are not merged down to a bare type. * docs(gemini): note that the gemini provider shares the tool-schema adaptation The schema sanitizer runs in translate_request_for_model before the Gemini adapter picks a transport, so kind = "gemini" upstreams get the same tuple folding and typeless-element fallbacks as antigravity. Point the Gemini section of the providers guide at the Antigravity page's description and say there that it covers both providers, in all four locales. * docs(gemini): state that a typed items schema takes precedence over prefixItems A 2020-12 tuple that already carries a typed items schema keeps that schema and drops the positions, which the fold description left implicit. Say so in the Antigravity page's adaptation paragraph and its three locale copies. * fix(gemini): drop tuple keywords from a schema whose type is not array A type list such as ["string", "array"] flattens to string, and the prefixItems, array-valued items, or boolean items that described the array member rode along into a shape the Schema proto has no field for. Remove them from any schema whose resolved type is not array, keeping an object-valued items as written, and document the rule in the Antigravity page and its three locale copies. * fix(gemini): drop a boolean items from a typeless non-array schema too Guarding the tuple-keyword cleanup on is_array_schema rather than on a non-array string type also catches a schema that declares no type and carries only a boolean items, which otherwise reached Gemini as a value its Schema field cannot hold. * perf(gemini): fold tuple positions in one pass instead of deduplicating a list Every typed position was compared against every distinct earlier one, which a request with many distinct positions turned quadratic. Keep only what the fold decides on — the first branch, whether the rest match it, and the type they share — so each branch is compared once. Also tighten the Antigravity page's note on typeless schemas: one carrying prefixItems or an array or object items is an array and is folded; only a lone boolean items is dropped.
1 parent 4f671f1 commit 3421716

13 files changed

Lines changed: 1018 additions & 3 deletions

File tree

‎.claude/agent-memory/review-review-cubic-reviewer/cubic-empty-review-clean-tree.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ plugin-provided "user flags" string that omits `-b`/`-c` as ambiguous, not autho
2121
when the working tree is clean — verify with `git status --porcelain` first. Re-running with
2222
`cubic review -j -b origin/main` on this repo took ~2+ minutes; ran in background via
2323
`run_in_background` and polled with a `ps`-based wait loop rather than blocking `sleep`.
24+
25+
**Inverse trap:** `-b` also has the opposite failure mode. When there ARE uncommitted
26+
changes but the task scope is specifically those uncommitted changes, `cubic review -j -b
27+
<base>` reviews the **committed** branch-vs-base diff and silently ignores the uncommitted
28+
working-tree edit — the report will be about unrelated already-committed files, not the
29+
thing you were asked to review (agy-429, 2026-09-03: task scoped to a one-line uncommitted
30+
frontmatter edit; `-b` returned a P3 finding on an unrelated committed file,
31+
`src/auth/antigravity/catalog.rs`, from earlier in the branch history). Before trusting a
32+
default-flags `-b` run against a stated review scope, cross-check that the flagged file(s)
33+
are actually inside `git diff`/`git status --porcelain`, not just `git diff <base>...HEAD`.

‎.please/docs/research/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
| ID | Title | Date | Tags |
66
|----|-------|------|------|
7+
| 003 | [JSON Schema sanitization for Gemini functionDeclarations across reference bridges](./md/003-json-schema-sanitization-for-gemini-functiondeclar.md) | 2026-09-03 | gemini, antigravity, json-schema, tool-calling, prefixitems |
78
| 002 | [openai/codex: model catalog sources, presets, metadata, and runtime fetching](./md/002-openaicodex-model-catalog-sources-presets-metadata.md) | 2026-07-18 | openai-codex, rust, models, model-catalog, config, api, reference |
89
| 001 | [openai/codex: how model_verbosity works end-to-end (config -> Responses API)](./md/001-openaicodex-how-modelverbosity-works-end-to-end-co.md) | 2026-07-14 | openai-codex, rust, responses-api, config, gpt-5, verbosity, reference |
910

10-
Total entries: 2
11+
Total entries: 3
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
id: 003
3+
title: "JSON Schema sanitization for Gemini functionDeclarations across reference bridges"
4+
date: 2026-09-03
5+
summary: "How CLIProxyAPI, gemini-cli, opencode, and claude-code-router/@musistudio/llms sanitize JSON Schema before sending tool definitions to Gemini / Antigravity, and specifically what each does with a tuple array (prefixItems, no items)."
6+
tags: [gemini, antigravity, json-schema, tool-calling, cliproxyapi, gemini-cli, opencode, prefixitems]
7+
---
8+
9+
# JSON Schema sanitization for Gemini functionDeclarations
10+
11+
Question: how do reference implementations sanitize JSON Schema before emitting Gemini
12+
`functionDeclarations`, and do they handle `{"type":"array","prefixItems":[...]}` with no `items`?
13+
14+
## 1. router-for-me/CLIProxyAPI (@ d577e630)
15+
16+
All cleaning lives in one file: `internal/util/gemini_schema.go`. Four entry points share
17+
`cleanJSONSchema(jsonStr, jsonSchemaCleanOptions)`:
18+
19+
| Function | Options |
20+
|---|---|
21+
| `CleanJSONSchemaForGemini` | `addMissingArrayItems`, `removeGeminiMetadata`, `flattenUnions`, `forceEnumStringType` |
22+
| `CleanJSONSchemaForAntigravity` / `...Tool(_, requirePlaceholder)` | `addPlaceholder`, `addMissingArrayItems`, `antigravitySemantics`, `flattenUnions`, `dropAllEnums` |
23+
| `CleanJSONSchemaForAntigravityResponse` | `antigravitySemantics`, `flattenUnions`, `dropBooleanEnums`, `preserveAdditionalPropertiesFalse` (no `addMissingArrayItems`) |
24+
25+
Pipeline (`cleanJSONSchema`): normalize malformed nodes → inline `$ref` / ref hints → `const`→`enum`
26+
→ enum→string → enum/additionalProperties/constraint hints → merge `if/then/else`, `allOf` → flatten
27+
`anyOf`/`oneOf` → flatten type arrays → remove unsupported keywords → cleanup `required` → empty-schema
28+
placeholder.
29+
30+
Removed outright (`removeUnsupportedKeywords`): `$schema`, `$defs`, `definitions`, `const`, `$ref`,
31+
`$id`, `additionalProperties`, `propertyNames`, `patternProperties`, `if`, `then`, `else`, `$comment`,
32+
`enumDescriptions`, `enumTitles`, `prefill`, `deprecated`, `encrypted`, all `x-*`, plus `not` for
33+
Antigravity. Moved into `description` then deleted (`unsupportedConstraints`): `minLength`, `maxLength`,
34+
`exclusiveMinimum`, `exclusiveMaximum`, `pattern`, `minItems`, `maxItems`, `uniqueItems`, `contains`,
35+
`format`, `default`, `examples` (+ `minimum`, `maximum`, `multipleOf` for Antigravity).
36+
37+
Tuple arrays: **`prefixItems` is never converted to `items` and never removed.** It is only recursed
38+
into for repair (`repairSchemaNode`, list keys `anyOf/oneOf/allOf/prefixItems`). Missing `items` is
39+
filled with a hardcoded string schema, independent of `prefixItems`:
40+
41+
```go
42+
// Gemini and Antigravity reject tool array schemas without an items definition.
43+
if addMissingArrayItems && isArrayDeclaredType(clone["type"]) {
44+
if _, hasItems := clone["items"]; !hasItems {
45+
clone["items"] = map[string]any{"type": "string"}
46+
modified = true
47+
}
48+
}
49+
```
50+
51+
So `{"type":"array","prefixItems":[{"type":"string"},{"type":"number"}]}` →
52+
`{"type":"array","prefixItems":[...],"items":{"type":"string"}}`. Response schemas keep the array with
53+
no `items` (test `TestCleanJSONSchema_ResponseArrayMissingItemsUnchanged`).
54+
55+
Call sites: `translator/gemini/claude/gemini_claude_request.go:244`,
56+
`translator/gemini/openai/chat-completions/gemini_openai_request.go:361`,
57+
`translator/antigravity/claude/antigravity_claude_request.go:808`,
58+
`runtime/executor/antigravity_executor_request.go:209/235`, `util/responses_tools.go:308`.
59+
All emit `parametersJsonSchema`; the Antigravity executor later renames it to `parameters`.
60+
61+
## 2. google-gemini/gemini-cli (@ 55b495d6)
62+
63+
No tool-schema sanitizer at HEAD. MCP tool schemas pass through verbatim:
64+
`packages/core/src/tools/mcp-client.ts:1429` sets `parametersJsonSchema: this.toolDef.inputSchema`.
65+
`prefixItems` appears only in `packages/core/src/utils/schemaValidator.test.ts` (draft-2020-12 local
66+
validation via Ajv). The historical `sanitizeParameters` (in `tool-registry.ts`) is gone; forks still
67+
carry it (`ConardLi/easy-llm-cli`) and it only dropped `default` next to `anyOf` and non
68+
`enum`/`date-time` string `format` — no array/`items`/`prefixItems` logic ever.
69+
70+
## 3. Others
71+
72+
- **anomalyco/opencode** (@ f12e14cf) `packages/llm/src/protocols/utils/gemini-tool-schema.ts`:
73+
array with no `items` gets `items = {}`, and an item schema with no "schema intent" key gets
74+
`type: "string"`. `prefixItems` counts as schema intent but is NOT converted. The Moonshot
75+
projection in the sibling `tool-schema.ts` is the only one that does the real tuple conversion:
76+
`prefixItems` → `items` (single → that schema, many → `anyOf`), dropped if `items` already exists.
77+
- **musistudio/claude-code-router** (@ 5ad5083b): no schema code; transforms live in
78+
`@musistudio/llms`, `src/utils/gemini.util.ts` `cleanupParameters` (@ ac0fafec) — an allowlist
79+
(`type, format, title, description, nullable, enum, maxItems, minItems, properties, required,
80+
minProperties, maxProperties, minLength, maxLength, pattern, example, anyOf, propertyOrdering,
81+
default, items, minimum, maximum`) that deletes everything else, so **`prefixItems` is silently
82+
dropped and no `items` is synthesized** — a tuple array becomes a bare `{"type":"array"}`.
83+
84+
## Takeaway for a Gemini bridge
85+
86+
Only one reference (opencode's Moonshot path) derives `items` from `prefixItems`. The pragmatic,
87+
production-proven behavior for Gemini/Antigravity is CLIProxyAPI's: if `type` includes `array` and
88+
`items` is absent, inject `{"type":"string"}` — and, unlike CLIProxyAPI, also drop or fold
89+
`prefixItems` since Gemini's schema dialect does not define it.

‎site/src/content/docs/guides/providers.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ provider = "gemini"
4343
upstream_model = "gemini-2.5-flash"
4444
```
4545

46+
Tool declarations go through the same schema adaptation as the `antigravity` provider — both
47+
transports share one Gemini adapter — so the tuple folding and typeless-element fallbacks described
48+
under **What the adapter carries** on the [Antigravity provider page](/providers/antigravity/) apply
49+
to `gemini` routes as well.
50+
4651
Code Assist also recognizes preview slugs such as `gemini-3.1-pro-preview` and `gemini-3-flash-preview`, subject to account entitlement and provider capacity. It does not accept the Antigravity-only slugs such as `gemini-3.6-flash-medium`.
4752

4853
The separate `antigravity` provider reaches the same backend over HTTP. Authenticate it with `shunt login antigravity`: a Google

‎site/src/content/docs/ja/guides/providers.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ description: 組み込みプロバイダーと、TOML テーブルで任意の A
2828

2929
各名前から、そのプロバイダーの完全なセットアップを説明する専用ページへ移動できます。`shunt add upstream <name>` は、任意の組み込みプロバイダーについて手順を追ったブループリントを出力します。コーディングエージェントへパイプすれば(`shunt add upstream codex --print | claude`)、エージェントに設定を組み込ませることができます。[CLI リファレンス](/ja/reference/cli/#shunt-add)も参照してください。
3030

31+
`gemini` プロバイダーのツール宣言には、`antigravity` プロバイダーと同じスキーマ調整が適用されます。両方の転送が 1 つの Gemini
32+
アダプターを共有するため、[Antigravity プロバイダーページ](/ja/providers/antigravity/)の**アダプターが伝えるもの**で説明する
33+
タプルの畳み込みと型のない要素のフォールバックは `gemini` ルートにも適用されます。
34+
3135
### antigravity プロバイダー(Google Antigravity)
3236

3337
`antigravity` プロバイダーは、HTTP 経由で Google Antigravity バックエンドに到達します。`shunt login antigravity` で認証してください —

‎site/src/content/docs/ja/providers/antigravity.mdx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ Antigravity は Claude モデルも提供していますが、shunt はそれら
178178
同じセッションに届くよう会話中で最初に現れるユーザーテキストから導出した `sessionId` です。`gemini` プロバイダーの
179179
Code Assist リクエストは、これらをいずれも送りません。
180180

181+
**ツールスキーマは Gemini の `Schema` 方言に合わせて調整されます** — このプロバイダーでも、同じアダプターを共有する
182+
`gemini` プロバイダーでも同様です。 `$schema`、`$id`、`$comment`、
183+
`propertyNames`、`patternProperties`、`exclusiveMinimum`、`exclusiveMaximum`、`const` は削除され、それ以外の
184+
キーワードは書かれたとおりに転送されます。`type` のリストは最初の非 `null` 項目を保ち、リストに `null` があれば
185+
`nullable: true` が設定され、`null` だけのリストは nullable な `string` になります。配列でない
186+
スキーマ — 別のメンバーに決まったユニオンでも、単なるスカラーでも — は `prefixItems` とスキーマオブジェクトでない `items` を捨て、
187+
オブジェクト値の `items` はそのまま保ちます。型のないスキーマは、`prefixItems` か配列値またはオブジェクト値の `items` を
188+
持てば配列として扱われ、そうでなければ単独の boolean の `items` だけを捨てます。すべての配列は単一の `items`
189+
スキーマで送られます: タプル — `prefixItems`、または draft-07 の配列値 `items` — は 1 つに畳み込まれ、同一の
190+
位置はそのスキーマを保ち、配列以外の型だけが一致する位置はその型を保ち、それ以外は先頭の位置のスキーマが
191+
残ります。`prefixItems` の隣に型を宣言した `items` スキーマがすでにある場合は、そのスキーマがそのまま保たれ、
192+
位置は捨てられます。型が `anyOf`/`oneOf`/`allOf` の分岐にある要素も同じ方法で畳み込まれます。要素について何も述べない
193+
配列や、要素スキーマが型を宣言しない配列は、要素が `enum` や `properties` で型を暗示しない限り
194+
`items: {"type": "string"}` として送られます。これらのフォールバックはリクエストを拒否する代わりに要素の型を
195+
狭めるので、タプルが `string` 型で届くツールはルーティングの誤りではなく、この調整が働いた結果です。
196+
181197
本番トラフィックをルーティングする前に知っておく価値のある制限が 2 つあります。
182198

183199
- **画像はインラインである必要があります。** base64 の `image` ブロックは Gemini の `inlineData` になります。

‎site/src/content/docs/ko/guides/providers.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ description: 내장 프로바이더와 TOML 테이블로 Anthropic 호환 백엔
2828

2929
각 이름은 전체 설정을 설명하는 해당 프로바이더의 전용 페이지로 연결됩니다. `shunt add upstream <name>`은 모든 내장 프로바이더의 단계별 블루프린트를 출력합니다. 이를 코딩 에이전트에 파이프로 전달하면(`shunt add upstream codex --print | claude`) 에이전트가 구성을 연결하도록 할 수 있습니다. [CLI 레퍼런스](/ko/reference/cli/#shunt-add)를 참고하세요.
3030

31+
`gemini` 프로바이더의 도구 선언은 `antigravity` 프로바이더와 동일한 스키마 조정을 거칩니다. 두 전송이 하나의 Gemini 어댑터를
32+
공유하므로, [Antigravity 프로바이더 페이지](/ko/providers/antigravity/)의 **어댑터가 전달하는 것**에서 설명한 튜플 접기와 타입
33+
없는 요소 폴백이 `gemini` 라우트에도 적용됩니다.
34+
3135
### antigravity 프로바이더 (Google Antigravity)
3236

3337
`antigravity` 프로바이더는 HTTP를 통해 Google Antigravity 백엔드에 도달합니다. `shunt login antigravity`로 인증하세요 —

‎site/src/content/docs/ko/providers/antigravity.mdx‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,23 @@ Antigravity는 Claude 모델도 제공하지만, shunt는 아직 그 모델들
173173
같은 세션에 도달하도록 대화에서 가장 먼저 나오는 사용자 텍스트에서 유도한 `sessionId`입니다. `gemini` 프로바이더의 Code Assist
174174
요청은 이 중 어느 것도 보내지 않습니다.
175175

176+
**도구 스키마는 Gemini의 `Schema` 방언에 맞게 조정됩니다** — 이 프로바이더와, 같은 어댑터를 쓰는 `gemini`
177+
프로바이더 모두에서요. `$schema`, `$id`, `$comment`,
178+
`propertyNames`, `patternProperties`, `exclusiveMinimum`, `exclusiveMaximum`, `const`는 제거되고, 그 외의
179+
키워드는 작성된 그대로 전달됩니다. `type` 목록은 첫 번째 non-`null` 항목을 유지하며, 목록에 `null`이 있으면
180+
`nullable: true`가 설정되고, `null`만 있는 목록은 nullable `string`이 됩니다. 배열이 아닌 모든
181+
스키마 — 다른 멤버로 정해진 유니언이든, 평범한 스칼라든 — 는 `prefixItems`와 스키마 객체가 아닌 `items`를 버리고, 객체 값
182+
`items`는 그대로 유지합니다. 타입 없는 스키마는 `prefixItems`나 배열 값 또는 객체 값 `items`를 가지면 배열로 취급되고,
183+
그렇지 않으면 홀로 남은 불리언 `items`만 버립니다. 모든 배열은 단일 `items`
184+
스키마로 전송됩니다: 튜플 — `prefixItems`, 또는 draft-07의 배열 값 `items` — 은 하나로 접히는데, 동일한
185+
위치들은 그 스키마를 유지하고, 배열이 아닌 타입만 일치하는 위치들은 그 타입을 유지하며, 그 외에는 첫
186+
위치의 스키마가 남습니다. `prefixItems` 옆에 타입이 선언된 `items` 스키마가 이미 있으면 그 스키마가 그대로
187+
유지되고 위치들은 버려집니다. 타입이 `anyOf`/`oneOf`/`allOf` 분기 안에 있는 요소도 같은 방식으로 접힙니다.
188+
요소에 대해 아무것도 말하지 않는 배열이나 요소 스키마가 타입을 선언하지 않는 배열은, 요소가 `enum`이나
189+
`properties`로 타입을 암시하지 않는 한 `items: {"type": "string"}`으로 전송됩니다. 이 폴백은 요청을
190+
거부하는 대신 요소 타입을 좁히므로, 튜플이 `string` 타입으로 도착하는 도구는 라우팅 오류가 아니라 이 조정이
191+
동작한 결과입니다.
192+
176193
프로덕션 트래픽을 라우팅하기 전에 알아둘 만한 제한이 두 가지 있습니다:
177194

178195
- **이미지는 인라인이어야 합니다.** base64 `image` 블록은 Gemini `inlineData`가 됩니다. **URL 이미지

‎site/src/content/docs/providers/antigravity.mdx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,25 @@ derived from the earliest user text in the conversation so follow-up turns land
180180
session. The `gemini`
181181
provider's Code Assist requests carry none of these.
182182

183+
**Tool schemas are adapted** to Gemini's `Schema` dialect — on this provider and on `gemini`, which
184+
shares the adapter. `$schema`, `$id`, `$comment`,
185+
`propertyNames`, `patternProperties`, `exclusiveMinimum`, `exclusiveMaximum`, and `const` are dropped;
186+
every other keyword is forwarded as written. A `type` list keeps its first non-`null` entry, a `null`
187+
in the list sets `nullable: true`, and a null-only list becomes a nullable `string`. Any schema that is
188+
not an array — a union that settled on another member, or a plain scalar — drops `prefixItems` and any
189+
`items` that is not a schema object, keeping an object-valued `items` as written; a typeless schema counts
190+
as an array when it carries `prefixItems` or an array- or object-valued `items`, and otherwise loses a lone
191+
boolean `items`. Every array is
192+
sent with a single `items` schema: a tuple — `prefixItems`, or draft-07's array-valued `items` — is
193+
folded into one, where identical positions keep their schema, positions that agree only on a
194+
non-array type keep that type, and otherwise the first position's schema stands. A typed `items`
195+
schema already sitting beside `prefixItems` is kept as written and the positions are dropped. An element whose
196+
type lives in `anyOf`/`oneOf`/`allOf` arms is folded the same way. An array that says nothing about
197+
its elements, or whose element schema declares no type, is sent with `items: {"type": "string"}`
198+
unless the element implies its type through `enum` or `properties`. These fallbacks narrow the
199+
element type rather than rejecting the request, so a tool whose tuple arrives typed as `string` is
200+
this adaptation at work, not a routing error.
201+
183202
Two limits are worth knowing before you route production traffic:
184203

185204
- **Images must be inline.** A base64 `image` block becomes Gemini `inlineData`. A **URL image

‎site/src/content/docs/zh-cn/guides/providers.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ description: 内置的提供方,以及如何用一个 TOML 表添加任意兼容
3131
(`shunt add upstream codex --print | claude`),即可让 agent 为你完成配置。见
3232
[CLI 参考](/zh-cn/reference/cli/#shunt-add)。
3333

34+
`gemini` 提供方的工具声明会经过与 `antigravity` 提供方相同的 schema 调整。两种传输共用同一个 Gemini 适配器,因此
35+
[Antigravity 提供方页面](/zh-cn/providers/antigravity/)的**适配器承载的内容**中所述的元组折叠和无类型元素回退同样适用于
36+
`gemini` 路由。
37+
3438
### antigravity 提供方(Google Antigravity)
3539

3640
`antigravity` 提供方通过 HTTP 触达 Google Antigravity 后端。用 `shunt login antigravity` 认证:这是一个使用 Antigravity

0 commit comments

Comments
 (0)