[GH-ISSUE #7103] [Bug] Gemini-backed clients reject the 6.8.0 default compact tool catalog: jsonValueSchema() emits a multi-type array alongside a sibling items: {} #4275

Closed
opened 2026-10-31 00:48:24 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @carcraze on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7103

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

MCP or agent integration

Observed behavior

After upgrading to rea-agents@6.8.0 (where compact is now the default REA_MCP_INPUT_SCHEMA_PROFILE) and connecting over MCP stdio to a Gemini-backed client (opencode 1.19.2 on Linux x86_64), every turn fails with HTTP 400 rejecting the tool catalog across 25 tools (analyze_javascript_application, analyze_web_bundle, capture_browser_scenario, import_managed_reconstruction, reconcile_javascript_runtime, trace_application_feature, verify_managed_native_boundaries, etc.):

* GenerateContentRequest.tools[0].function_declarations[56].parameters.properties[source_paths].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[56].parameters.properties[source_paths].items.any_of[2].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[58].parameters.properties[allowed_origins].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[58].parameters.properties[allowed_origins].items.any_of[2].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[63].parameters.properties[functions].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[63].parameters.properties[functions].items.any_of[2].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[64].parameters.properties[reviewed_obligations].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[64].parameters.properties[reviewed_obligations].items.any_of[2].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[secrets].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[secrets].items.any_of[2].items: missing field.
* GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[actions].items.items: field predicate failed: $type == Type.ARRAY
* GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[actions].items.any_of[2].items: missing field.

Reproduction

  1. Run npx rea-agents@6.8.0 setup and register OpenCode / Gemini CLI (which uses the default compact input schema profile in 6.8.0).
  2. Start a Gemini session in OpenCode (1.19.2) with the rea MCP server enabled and send any prompt.
  3. Observe 100% deterministic rejection of the tool catalog on every turn with the paired items.items: field predicate failed: $type == Type.ARRAY and items.any_of[2].items: missing field errors above.

Expected behavior

The default compact input schema profile in 6.8.0 should emit array item schemas that survive MCP-to-Gemini FunctionDeclaration conversion without requiring REA_MCP_INPUT_SCHEMA_PROFILE=full.

Impact and scope

100% of turns fail on Gemini-backed clients that expand JSON Schema type arrays (type: ["null", "boolean", "object", "array", "number", "string"]) into any_of branches when using the default 6.8.0 registration.

Scanning tools/list on rea-agents@6.8.0 shows:

  • profile=compact: 25 occurrences across the 223 tools where a schema node carries both type: ["null", "boolean", "object", "array", "number", "string"] and items: {}.
  • profile=full: 0 occurrences (and 0 empty-string const/enum literals after #5201 / 88e37806).

REA version

6.8.0

Runtime and platform

Node v24.22.1; Ubuntu Linux x86_64; OpenCode 1.19.2

Target and artifact context

not applicable (fails during MCP tool-catalog registration before any tool call)

Interface

MCP

Earliest failure stage

Transport or result projection

Relevant output or evidence

Stdio tools/list inspection of rea-agents@6.8.0 under compact (default) vs full:

profile=compact: tools=223 multiTypeWithItems=25 emptyConstOrEnum=0
profile=full:    tools=223 multiTypeWithItems=0  emptyConstOrEnum=0

Sample compact hits:
  verify_managed_native_boundaries.properties.native_observations.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  import_managed_reconstruction.properties.methods.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  import_managed_reconstruction.properties.notes.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  analyze_web_bundle.properties.allowed_origins.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  capture_browser_scenario.properties.actions.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  capture_browser_scenario.properties.secrets.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}
  analyze_javascript_application.properties.source_paths.items -> {"type":["null","boolean","object","array","number","string"],"items":{}}

Analysis or suspected cause

Source-derived from src/contracts/compactInputSchema.ts and reduceToShallowProperties (line 456):

const jsonValueTypes = [
  "null",
  "boolean",
  "object",
  "array",
  "number",
  "string",
];
const jsonValueSchema = () => ({ type: [...jsonValueTypes], items: {} });

When a tool falls back to reduceToShallowProperties, every array-typed root property gets items: jsonValueSchema(). When an MCP client converts type: ["null", "boolean", "object", "array", "number", "string"], items: {} into a Gemini FunctionDeclaration, it expands the multi-type array into any_of: [{type: "BOOLEAN"}, {type: "OBJECT"}, {type: "ARRAY"}, {type: "NUMBER"}, {type: "STRING"}] while leaving items: {} on the outer node:

  1. The outer items node now has any_of (so its $type is not Type.ARRAY) alongside items: {} → Gemini fails with ...items.items: field predicate failed: $type == Type.ARRAY.
  2. The inner any_of[2] branch ({type: "ARRAY"}) has no items field → Gemini fails with ...items.any_of[2].items: missing field.

Additional context

Related to #5201 and #4620. Workaround in 6.8.0: setting REA_MCP_INPUT_SCHEMA_PROFILE=full avoids compactInputSchema and eliminates all 25 occurrences.

Originally created by @carcraze on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/7103 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area MCP or agent integration ### Observed behavior After upgrading to `rea-agents@6.8.0` (where `compact` is now the default `REA_MCP_INPUT_SCHEMA_PROFILE`) and connecting over MCP stdio to a Gemini-backed client (`opencode 1.19.2` on Linux x86_64), every turn fails with HTTP 400 rejecting the tool catalog across 25 tools (`analyze_javascript_application`, `analyze_web_bundle`, `capture_browser_scenario`, `import_managed_reconstruction`, `reconcile_javascript_runtime`, `trace_application_feature`, `verify_managed_native_boundaries`, etc.): ```text * GenerateContentRequest.tools[0].function_declarations[56].parameters.properties[source_paths].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[56].parameters.properties[source_paths].items.any_of[2].items: missing field. * GenerateContentRequest.tools[0].function_declarations[58].parameters.properties[allowed_origins].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[58].parameters.properties[allowed_origins].items.any_of[2].items: missing field. * GenerateContentRequest.tools[0].function_declarations[63].parameters.properties[functions].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[63].parameters.properties[functions].items.any_of[2].items: missing field. * GenerateContentRequest.tools[0].function_declarations[64].parameters.properties[reviewed_obligations].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[64].parameters.properties[reviewed_obligations].items.any_of[2].items: missing field. * GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[secrets].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[secrets].items.any_of[2].items: missing field. * GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[actions].items.items: field predicate failed: $type == Type.ARRAY * GenerateContentRequest.tools[0].function_declarations[66].parameters.properties[actions].items.any_of[2].items: missing field. ``` ### Reproduction 1. Run `npx rea-agents@6.8.0 setup` and register OpenCode / Gemini CLI (which uses the default `compact` input schema profile in `6.8.0`). 2. Start a Gemini session in OpenCode (`1.19.2`) with the `rea` MCP server enabled and send any prompt. 3. Observe 100% deterministic rejection of the tool catalog on every turn with the paired `items.items: field predicate failed: $type == Type.ARRAY` and `items.any_of[2].items: missing field` errors above. ### Expected behavior The default `compact` input schema profile in `6.8.0` should emit array item schemas that survive MCP-to-Gemini `FunctionDeclaration` conversion without requiring `REA_MCP_INPUT_SCHEMA_PROFILE=full`. ### Impact and scope 100% of turns fail on Gemini-backed clients that expand JSON Schema type arrays (`type: ["null", "boolean", "object", "array", "number", "string"]`) into `any_of` branches when using the default `6.8.0` registration. Scanning `tools/list` on `rea-agents@6.8.0` shows: - `profile=compact`: **25 occurrences** across the 223 tools where a schema node carries both `type: ["null", "boolean", "object", "array", "number", "string"]` and `items: {}`. - `profile=full`: **0 occurrences** (and **0** empty-string `const`/`enum` literals after #5201 / `88e37806`). ### REA version 6.8.0 ### Runtime and platform Node v24.22.1; Ubuntu Linux x86_64; OpenCode 1.19.2 ### Target and artifact context not applicable (fails during MCP tool-catalog registration before any tool call) ### Interface MCP ### Earliest failure stage Transport or result projection ### Relevant output or evidence Stdio `tools/list` inspection of `rea-agents@6.8.0` under `compact` (default) vs `full`: ```text profile=compact: tools=223 multiTypeWithItems=25 emptyConstOrEnum=0 profile=full: tools=223 multiTypeWithItems=0 emptyConstOrEnum=0 Sample compact hits: verify_managed_native_boundaries.properties.native_observations.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} import_managed_reconstruction.properties.methods.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} import_managed_reconstruction.properties.notes.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} analyze_web_bundle.properties.allowed_origins.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} capture_browser_scenario.properties.actions.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} capture_browser_scenario.properties.secrets.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} analyze_javascript_application.properties.source_paths.items -> {"type":["null","boolean","object","array","number","string"],"items":{}} ``` ### Analysis or suspected cause Source-derived from [`src/contracts/compactInputSchema.ts`](https://github.com/morluto/rea/blob/rea-agents-6.8.0/src/contracts/compactInputSchema.ts#L21-L31) and `reduceToShallowProperties` (line 456): ```ts const jsonValueTypes = [ "null", "boolean", "object", "array", "number", "string", ]; const jsonValueSchema = () => ({ type: [...jsonValueTypes], items: {} }); ``` When a tool falls back to `reduceToShallowProperties`, every array-typed root property gets `items: jsonValueSchema()`. When an MCP client converts `type: ["null", "boolean", "object", "array", "number", "string"], items: {}` into a Gemini `FunctionDeclaration`, it expands the multi-type array into `any_of: [{type: "BOOLEAN"}, {type: "OBJECT"}, {type: "ARRAY"}, {type: "NUMBER"}, {type: "STRING"}]` while leaving `items: {}` on the outer node: 1. The outer `items` node now has `any_of` (so its `$type` is not `Type.ARRAY`) alongside `items: {}` → Gemini fails with `...items.items: field predicate failed: $type == Type.ARRAY`. 2. The inner `any_of[2]` branch (`{type: "ARRAY"}`) has no `items` field → Gemini fails with `...items.any_of[2].items: missing field.` ### Additional context Related to #5201 and #4620. Workaround in `6.8.0`: setting `REA_MCP_INPUT_SCHEMA_PROFILE=full` avoids `compactInputSchema` and eliminates all 25 occurrences.
Author
Owner

@XinwangTao commented on GitHub (Oct 25, 2026):

确认是真实且严重的兼容性 bug:6.8.0 把 compact 设为默认后,array item 被编码成 multi-type any_of(如 string | array)时,schema 同时携带 items:{} 会导致 Gemini FunctionDeclaration 的 items 校验直接失败($type == Type.ARRAY / missing field),整份 tool catalog 被拒。这正好解释了为何是 100% 确定性失败而不是偶发。

赞同把 compact 的 array item 生成逻辑收敛为符合 MCP→Gemini 转换约束的形式:要么 item 用单一类型,要么在 multi-type 场景下不发出多余的 items 字段。建议在修复时补一个针对 Gemini 客户端(或等价校验器)的回归测试,遍历 compact 全量 223 个工具做一次转换校验,防止下次默认 profile 调整再次踩到同样的坑。

<!-- gh-comment-id:6396011661 --> @XinwangTao commented on GitHub (Oct 25, 2026): 确认是真实且严重的兼容性 bug:6.8.0 把 compact 设为默认后,array item 被编码成 multi-type any_of(如 string | array)时,schema 同时携带 items:{} 会导致 Gemini FunctionDeclaration 的 items 校验直接失败($type == Type.ARRAY / missing field),整份 tool catalog 被拒。这正好解释了为何是 100% 确定性失败而不是偶发。 赞同把 compact 的 array item 生成逻辑收敛为符合 MCP→Gemini 转换约束的形式:要么 item 用单一类型,要么在 multi-type 场景下不发出多余的 items 字段。建议在修复时补一个针对 Gemini 客户端(或等价校验器)的回归测试,遍历 compact 全量 223 个工具做一次转换校验,防止下次默认 profile 调整再次踩到同样的坑。
Author
Owner

@kaoru0822-kitauji commented on GitHub (Oct 25, 2026):

This is the same compact-profile shape as #5201: reduced array properties advertised their items as a multi-type list with a nested items, which Gemini rejects. PR #7107 (opened earlier today) changes the one compact producer (src/contracts/compactInputSchema.ts) so reduced arrays advertise the element type their real item schema accepts, and adds a catalog-wide guard. On its build, a stdio tools/list scan of the default profile finds 0 items beside a non-array type and 0 untyped item unions; for example every allowed_origins is now {"type":"array","items":{"type":"string"...}}. Not run: a live Gemini/opencode request. #7114 targets the same file, so maintainers may want to pick one.

🤖 Written with Claude Code (Opus 5.5)

<!-- gh-comment-id:6396305555 --> @kaoru0822-kitauji commented on GitHub (Oct 25, 2026): This is the same compact-profile shape as #5201: reduced array properties advertised their items as a multi-type list with a nested `items`, which Gemini rejects. PR #7107 (opened earlier today) changes the one compact producer (`src/contracts/compactInputSchema.ts`) so reduced arrays advertise the element type their real item schema accepts, and adds a catalog-wide guard. On its build, a stdio `tools/list` scan of the default profile finds 0 `items` beside a non-`array` type and 0 untyped item unions; for example every `allowed_origins` is now `{"type":"array","items":{"type":"string"...}}`. Not run: a live Gemini/opencode request. #7114 targets the same file, so maintainers may want to pick one. 🤖 Written with Claude Code (Opus 5.5)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4275
No description provided.