Skip to content

fix(mcp): support Codex-compatible input schemas - #500

Open
cameroncooke wants to merge 3 commits into
mainfrom
codex/fix-491-codex-schema-compatibility
Open

fix(mcp): support Codex-compatible input schemas#500
cameroncooke wants to merge 3 commits into
mainfrom
codex/fix-491-codex-schema-compatibility

Conversation

@cameroncooke

@cameroncooke cameroncooke commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Codex 0.31 rejects valid MCP input schemas when a record is represented with a
schema-valued additionalProperties. Seven environment inputs now use readable
{ key, value } arrays on the MCP wire, and Xcode IDE tool arguments use a JSON
object string. Each input is decoded once at the tool boundary; CLI and domain
callers keep their existing object-shaped inputs and normal tool behavior is
unchanged.

Regression coverage captures one readable contract per static MCP tool in both
session-default modes (82 tools × 2). The build-first gate reproduces all eight
historical Codex failures per mode, checks the exact Codex 0.31 conversion
boundary, validates structured-output contracts, exercises live handlers, and
now passes the full catalog with zero incompatibilities.

The full non-update snapshot suite remains red on this host because its stored
fixtures predate the installed Xcode/device environment and AXe cannot load the
missing Xcode SimulatorKit.framework; the changed Xcode IDE snapshot suite
passes. No unrelated snapshots are updated here.

Fixes #491

Normalize published MCP schemas for Codex compatibility and add build-first static contract baselines for adaptive and full session-default modes.

Fixes #491
Copilot AI review requested due to automatic review settings August 1, 2026 02:31
@pkg-pr-new

pkg-pr-new Bot commented Aug 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@500

commit: 904afdf

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR normalizes the published MCP tool input/output JSON schemas at the MCP registration boundary to improve Codex compatibility, and introduces a build-backed “fail-closed” contract-test baseline for the MCP static tool surface.

Changes:

  • Normalize MCP input schemas derived from tool Zod shapes to omit propertyNames while keeping Zod parsing constraints intact.
  • Normalize MCP output registration schemas similarly, and refactor tool registration to centralize the registration config.
  • Add a dedicated build-dependent contract-test harness + fixtures and isolate it from the default npm test Vitest run.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vitest.contract.config.ts Adds a dedicated Vitest config for build-backed contract tests.
vitest.config.ts Excludes src/contract-tests/** from the default unit test suite.
src/utils/tool-registry.ts Centralizes MCP tool registration config and normalizes schemas at registration time.
src/utils/mcp-input-schema.ts Implements Codex-focused JSON schema normalization and MCP input-schema wrapping.
src/utils/tests/mcp-input-schema.test.ts Unit tests ensuring schema normalization doesn’t affect parsing behavior.
src/core/structured-output-schema.ts Normalizes output registration JSON schemas for Codex compatibility.
src/contract-tests/capture-mcp-tool-contracts.ts Captures and validates the MCP static tool contract surface via an in-memory MCP client/server.
src/contract-tests/tests/mcp-tool-contracts.test.ts Verifies captured contracts match committed adaptive/full baselines.
package.json Adds test:tool-contracts script to build then run contract tests.
CHANGELOG.md Documents the Codex schema-compatibility fix and new contract baseline gate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to 6
import { z, type ZodType } from 'zod';
import { getStructuredOutputSchemasDir } from './resource-root.ts';
import { normalizeMcpSchemaForCodex } from '../utils/mcp-input-schema.ts';

Expose Codex-compatible MCP wire schemas for record-shaped environment
inputs and arbitrary Xcode arguments while preserving object-based CLI
and domain inputs.

Add build-first, fail-closed per-tool contract fixtures for both public
schema modes and validate the complete static catalog.

Fixes #491
Copilot AI review requested due to automatic review settings August 2, 2026 08:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@cameroncooke cameroncooke changed the title fix(mcp): normalize Codex tool schemas fix(mcp): support Codex-compatible input schemas Aug 2, 2026
Require valid domain output schemas on Apple hosts while accepting only
specific downstream missing-tool signatures on Linux CI.

Refs #491
Copilot AI review requested due to automatic review settings August 2, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Offer: a manifest gate for the schema bug class

2 participants