[PR #535] [MERGED] fix(mcp): emit valid schemas for empty arrays #2055

Closed
opened 2026-10-16 21:13:48 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/535
Author: @N0zoM1z0
Created: 10/5/2026
Status: ✅ Merged
Merged: 10/5/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/mcp-empty-array-schemas-528


📝 Commits (1)

  • d79e6c6 fix(mcp): emit valid schemas for empty arrays

📊 Changes

18 files changed (+224 additions, -22 deletions)

View changed files

📝 docs/product-catalog.json (+2 -2)
📝 docs/verification/managed-conformance-manifest.json (+2 -2)
📝 package-lock.json (+59 -0)
📝 package.json (+1 -0)
📝 scripts/generate-mcp-tool-catalog.mjs (+11 -0)
📝 scripts/lib/verify-package-core.mjs (+12 -1)
📝 skills/reverse-engineer-anything/SKILL.md (+1 -1)
📝 src/domain/browserScenarioCaptureValues.ts (+4 -3)
📝 src/domain/callPathSchemas.ts (+3 -2)
➕ src/domain/emptyArraySchema.test.ts (+21 -0)
➕ src/domain/emptyArraySchema.ts (+4 -0)
📝 src/domain/javascriptApplicationVersionComparisonSchemas.ts (+2 -1)
📝 src/domain/managedMemberComparison.ts (+5 -4)
📝 src/domain/managedNativeVerificationSchemas.ts (+2 -1)
📝 src/domain/webBundleAnalysis.ts (+4 -3)
📝 src/domain/webCaptureDiffSchemas.ts (+2 -1)
📝 src/generatedMcpToolCatalog.ts (+1 -1)
➕ tests/boundary/mcp/toolSchemaValidity.test.ts (+88 -0)

📄 Description

Summary

  • Replace every empty Zod tuple used by tool contracts with a shared empty-array schema. This fixes the invalid input schema for compare_web_captures and the invalid output schemas of seven tools, while preserving rejection of nonempty arrays.
  • Validate every advertised input and output schema against the JSON Schema Draft 2020-12 meta-schema during catalog generation and packaged MCP verification. Ajv is a pinned development dependency.
  • Add regression coverage for SDK tools/list, the generated catalog, and empty-array semantics. Regenerate the catalog and dependent identity metadata through the normal generators.

Closes #528.

MCP schema example

The affected tools/list fields now use this valid empty-array representation:

{
  "missing_sections": {
    "type": "array",
    "items": { "not": {} },
    "minItems": 0,
    "maxItems": 0
  }
}

Regression evidence

  • Before the fix, the live registration and generated-catalog tests rejected eight schemas across seven tools. Reintroducing the empty tuple after the fix also makes the regression tests fail.
  • After the fix, the focused tests pass repeatedly. A separate stdio MCP process advertises 122 tools; all 244 input/output schemas pass an independent Python Draft 2020-12 check.
  • Comparing the actual pre/post tools/list responses confirms that only the empty-array schema representation changes.

Verification

Commands were run with the isolated Node 24 toolchain:

npm run docs:generate
npm run check:pr
env -u GHIDRA_INSTALL_DIR -u JAVA_HOME -u REA_ANALYSIS_PROVIDER TMPDIR=/tmp npm run verify:package
npm pack --dry-run

check:pr: 363 test files passed; 1,911 tests passed and two existing platform-dependent tests skipped, plus typecheck, lint, format, dependency-use, metadata, and generated-document checks.

For the package lane, a temporary directory outside the checkout prevents Node from resolving omitted optional dependencies from the checkout's node_modules. Ghidra variables are removed only for that command so the fixture provider is selected without interference from the local bring-your-own installation. No host defaults were changed.

Provider verification

Real Hopper/Ghidra verification was not run for this schema-only change. The package lane uses fixture providers; the separate stdio MCP schema check uses the actual server without opening a target. No live Anthropic API request was made.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/535 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/5/2026 **Status:** ✅ Merged **Merged:** 10/5/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/mcp-empty-array-schemas-528` --- ### 📝 Commits (1) - [`d79e6c6`](https://github.com/morluto/rea/commit/d79e6c6e6e810493dfc76b5e71a62bbfe67d764a) fix(mcp): emit valid schemas for empty arrays ### 📊 Changes **18 files changed** (+224 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `docs/product-catalog.json` (+2 -2) 📝 `docs/verification/managed-conformance-manifest.json` (+2 -2) 📝 `package-lock.json` (+59 -0) 📝 `package.json` (+1 -0) 📝 `scripts/generate-mcp-tool-catalog.mjs` (+11 -0) 📝 `scripts/lib/verify-package-core.mjs` (+12 -1) 📝 `skills/reverse-engineer-anything/SKILL.md` (+1 -1) 📝 `src/domain/browserScenarioCaptureValues.ts` (+4 -3) 📝 `src/domain/callPathSchemas.ts` (+3 -2) ➕ `src/domain/emptyArraySchema.test.ts` (+21 -0) ➕ `src/domain/emptyArraySchema.ts` (+4 -0) 📝 `src/domain/javascriptApplicationVersionComparisonSchemas.ts` (+2 -1) 📝 `src/domain/managedMemberComparison.ts` (+5 -4) 📝 `src/domain/managedNativeVerificationSchemas.ts` (+2 -1) 📝 `src/domain/webBundleAnalysis.ts` (+4 -3) 📝 `src/domain/webCaptureDiffSchemas.ts` (+2 -1) 📝 `src/generatedMcpToolCatalog.ts` (+1 -1) ➕ `tests/boundary/mcp/toolSchemaValidity.test.ts` (+88 -0) </details> ### 📄 Description ## Summary - Replace every empty Zod tuple used by tool contracts with a shared empty-array schema. This fixes the invalid input schema for `compare_web_captures` and the invalid output schemas of seven tools, while preserving rejection of nonempty arrays. - Validate every advertised input and output schema against the JSON Schema Draft 2020-12 meta-schema during catalog generation and packaged MCP verification. Ajv is a pinned development dependency. - Add regression coverage for SDK `tools/list`, the generated catalog, and empty-array semantics. Regenerate the catalog and dependent identity metadata through the normal generators. Closes #528. ### MCP schema example The affected `tools/list` fields now use this valid empty-array representation: ```json { "missing_sections": { "type": "array", "items": { "not": {} }, "minItems": 0, "maxItems": 0 } } ``` ## Regression evidence - Before the fix, the live registration and generated-catalog tests rejected eight schemas across seven tools. Reintroducing the empty tuple after the fix also makes the regression tests fail. - After the fix, the focused tests pass repeatedly. A separate stdio MCP process advertises 122 tools; all 244 input/output schemas pass an independent Python Draft 2020-12 check. - Comparing the actual pre/post `tools/list` responses confirms that only the empty-array schema representation changes. ## Verification Commands were run with the isolated Node 24 toolchain: ```sh npm run docs:generate npm run check:pr env -u GHIDRA_INSTALL_DIR -u JAVA_HOME -u REA_ANALYSIS_PROVIDER TMPDIR=/tmp npm run verify:package npm pack --dry-run ``` `check:pr`: 363 test files passed; 1,911 tests passed and two existing platform-dependent tests skipped, plus typecheck, lint, format, dependency-use, metadata, and generated-document checks. For the package lane, a temporary directory outside the checkout prevents Node from resolving omitted optional dependencies from the checkout's `node_modules`. Ghidra variables are removed only for that command so the fixture provider is selected without interference from the local bring-your-own installation. No host defaults were changed. ## Provider verification Real Hopper/Ghidra verification was not run for this schema-only change. The package lane uses fixture providers; the separate stdio MCP schema check uses the actual server without opening a target. No live Anthropic API request was made. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:13:48 +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#2055
No description provided.