Skip to content

fix(mcp): normalize Codex tool schemas - #500

Open
cameroncooke wants to merge 1 commit into
mainfrom
codex/fix-491-codex-schema-compatibility
Open

fix(mcp): normalize Codex tool schemas#500
cameroncooke wants to merge 1 commit into
mainfrom
codex/fix-491-codex-schema-compatibility

Conversation

@cameroncooke

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize published MCP input and output schemas at the registration boundary for Codex compatibility while retaining Zod parsing constraints.
  • Add readable, fail-closed adaptive and full static-tool contract baselines from the production MCP registration path.
  • Isolate the build-dependent contract gate from ordinary Vitest runs.

Fixes #491

Validation

  • npm test
  • npm run typecheck
  • npm run lint (107 existing warnings, no errors)
  • npm run format:check
  • npm run build
  • npm run test:tool-contracts
  • Snapshot and smoke suites were run but are not passing in this sandbox because CoreSimulatorService and required ~/Library paths are unavailable; logs were preserved locally.

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: 911d729

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';

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