[GH-ISSUE #528] compare_web_captures input schema rejected by Anthropic API: z.tuple([]) emits empty prefixItems #274

Closed
opened 2026-10-15 18:23:19 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Taas-ai on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/528

Summary

In rea-agents 3.2.1, the input schema for the compare_web_captures MCP tool contains "prefixItems": []. JSON Schema 2020-12 requires prefixItems to have at least one item, so the Anthropic API rejects the schema. Claude Code leaves the tool out of the session, while the other 113 rea tools load normally.

Error (as reported by Claude Code)

"compare_web_captures": schema/properties/before_scenario/properties/steps/items/anyOf/0/properties/completeness/oneOf/0/properties/missing_sections/prefixItems must NOT have fewer than 1 items

Root cause

dist/domain/browserScenarioCaptureValues.js (lines ~202–209) declares the "complete" completeness variant with empty tuples:

missing_sections: z.tuple([]),
truncated_sections: z.tuple([]),

Converting z.tuple([]) to JSON Schema gives {"type":"array","prefixItems":[]}, which breaks the 2020-12 meta-schema rule (prefixItems minItems 1). The generated catalog (dist/generatedMcpToolCatalog.js) includes it as:

"missing_sections":{"description":"Value for missing sections.","prefixItems":[],"type":"array"}

compare_web_captures takes this as input (before_scenario.steps[].completeness), so only that tool fails validation. The same z.tuple([]) pattern also appears in callPathSchemas.js, webCaptureDiffSchemas.js, managedNativeVerificationSchemas.js and webBundleAnalysis.js. Those uses currently look like output-only schemas, but they would hit the same problem if they ever became tool inputs.

Suggested fix

Express "empty array" without an empty tuple, for example:

missing_sections: z.array(z.enum([...sections])).max(0),

This produces {"type":"array","items":{...},"maxItems":0}, which is valid. Adding a check to the catalog generator that validates every tool inputSchema against the 2020-12 meta-schema would catch regressions.

Environment

  • rea-agents 3.2.1 (npm global, /opt/homebrew/lib/node_modules/rea-agents)
  • Node v25.8.1, macOS (Darwin 25.6.0, arm64)
  • Client: Claude Code, server registered as ["/opt/homebrew/bin/rea", "mcp"]; rea doctor reports registration aligned
  • Workaround: compare_web_screenshots / compare_process_captures still work
Originally created by @Taas-ai on GitHub (Oct 5, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/528 ## Summary In rea-agents 3.2.1, the input schema for the `compare_web_captures` MCP tool contains `"prefixItems": []`. JSON Schema 2020-12 requires `prefixItems` to have at least one item, so the Anthropic API rejects the schema. Claude Code leaves the tool out of the session, while the other 113 rea tools load normally. ## Error (as reported by Claude Code) ``` "compare_web_captures": schema/properties/before_scenario/properties/steps/items/anyOf/0/properties/completeness/oneOf/0/properties/missing_sections/prefixItems must NOT have fewer than 1 items ``` ## Root cause `dist/domain/browserScenarioCaptureValues.js` (lines ~202–209) declares the "complete" completeness variant with empty tuples: ```js missing_sections: z.tuple([]), truncated_sections: z.tuple([]), ``` Converting `z.tuple([])` to JSON Schema gives `{"type":"array","prefixItems":[]}`, which breaks the 2020-12 meta-schema rule (`prefixItems` minItems 1). The generated catalog (`dist/generatedMcpToolCatalog.js`) includes it as: ```json "missing_sections":{"description":"Value for missing sections.","prefixItems":[],"type":"array"} ``` `compare_web_captures` takes this as **input** (`before_scenario.steps[].completeness`), so only that tool fails validation. The same `z.tuple([])` pattern also appears in `callPathSchemas.js`, `webCaptureDiffSchemas.js`, `managedNativeVerificationSchemas.js` and `webBundleAnalysis.js`. Those uses currently look like output-only schemas, but they would hit the same problem if they ever became tool inputs. ## Suggested fix Express "empty array" without an empty tuple, for example: ```js missing_sections: z.array(z.enum([...sections])).max(0), ``` This produces `{"type":"array","items":{...},"maxItems":0}`, which is valid. Adding a check to the catalog generator that validates every tool `inputSchema` against the 2020-12 meta-schema would catch regressions. ## Environment - rea-agents 3.2.1 (npm global, `/opt/homebrew/lib/node_modules/rea-agents`) - Node v25.8.1, macOS (Darwin 25.6.0, arm64) - Client: Claude Code, server registered as `["/opt/homebrew/bin/rea", "mcp"]`; `rea doctor` reports registration aligned - Workaround: `compare_web_screenshots` / `compare_process_captures` still work
bsakaguchi 2026-10-15 18:23:19 +00:00
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#274
No description provided.