Skip to content

fix(mcp): tolerate invalid output schema - #2075

Merged
zerob13 merged 1 commit into
devfrom
codex/mcp-output-schema-compat
Jul 31, 2026
Merged

fix(mcp): tolerate invalid output schema#2075
zerob13 merged 1 commit into
devfrom
codex/mcp-output-schema-compat

Conversation

@zerob13

@zerob13 zerob13 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Keep MCP tool discovery working when an optional output schema is malformed.
  • Preserve strict input schema validation and warn when an invalid output schema is dropped.

Root cause

The built-in McDonald's MCP server returns an invalid output schema for mall-order-list at #/properties/data/items/properties/list/items/properties/type. The previous validation path rejected the entire tool list because of this optional field.

Validation

  • pnpm exec vitest run --config vitest.config.ts test/main/mcp/schemaValidation.test.ts
  • pnpm exec vitest run --config vitest.config.ts test/main/mcp/mcpClient.test.ts
  • pnpm run typecheck:node
  • pnpm run lint
  • pnpm run i18n
  • pnpm exec oxfmt --check src/main/mcp/schemaValidation.ts test/main/mcp/schemaValidation.test.ts

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of invalid tool output schemas.
    • Tools with invalid schemas can now continue loading, with the problematic schema omitted and a warning recorded.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 21a20265-37ce-47d3-97ba-902ac0b20e94

📥 Commits

Reviewing files that changed from the base of the PR and between 199e0c7 and 76211cd.

📒 Files selected for processing (1)
  • src/main/mcp/schemaValidation.ts

📝 Walkthrough

Walkthrough

validateAndCloneMcpTool now validates and clones optional outputSchema values. Invalid schemas trigger a warning and are omitted from the returned tool.

Changes

MCP output schema handling

Layer / File(s) Summary
Output schema validation and assignment
src/main/mcp/schemaValidation.ts
The validator clones valid outputSchema values. It logs a warning and omits invalid values. The returned tool uses the prevalidated schema.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mcp-output-schema-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zerob13
zerob13 marked this pull request as ready for review July 31, 2026 09:49
@dosubot

dosubot Bot commented Jul 31, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about deepchat Add Dosu to your team

@zerob13
zerob13 merged commit 5814a04 into dev Jul 31, 2026
12 checks passed
@zhangmo8
zhangmo8 deleted the codex/mcp-output-schema-compat branch July 31, 2026 09:55
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.

1 participant