Skip to content

fix(kosong): repair mismatched schema types from Xcode 26.5 MCP#343

Open
youngxhui wants to merge 8 commits into
MoonshotAI:mainfrom
youngxhui:fix/xcode-mcp-schema-type-mismatch
Open

fix(kosong): repair mismatched schema types from Xcode 26.5 MCP#343
youngxhui wants to merge 8 commits into
MoonshotAI:mainfrom
youngxhui:fix/xcode-mcp-schema-type-mismatch

Conversation

@youngxhui
Copy link
Copy Markdown

@youngxhui youngxhui commented Jun 2, 2026

Related Issue

Resolve #302

Problem

Xcode 26.5 (17F42) xcrun mcpbridge generates contradictory JSON Schemas where String-backed Swift enums incorrectly carry type: "object" alongside string enum values (e.g. ["move", "copy"]). Moonshot's tool validator rejects these as invalid, returning a 400 error that blocks all conversation after connecting the Xcode MCP server.

What changed

  • Extend normalizeKimiToolSchema to detect and repair explicit type declarations that contradict their enum or const values.
  • After repairing the type, automatically strip structure keys (properties, required, items, etc.) that are irrelevant for the new scalar type.
  • Keep a console.warn diagnostic so future mismatches are visible in logs.
  • Add 3 test cases covering enum mismatch, const mismatch, and mixed-type enums (left untouched).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue.
  • I have added tests that prove my fix works.
  • Ran gen-changesets skill.
  • Ran gen-docs skill, or this PR needs no doc update.

Xcode 26.5 (17F42) mcpbridge generates contradictory JSON Schemas where
String-backed Swift enums carry type: 'object' alongside string enum values.
Moonshot rejects these as invalid. Detect and repair the mismatch in
normalizeKimiToolSchema, stripping irrelevant structure keys after the fix.

Closes MoonshotAI#302
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

🦋 Changeset detected

Latest commit: 7c65c75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kosong Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d213ebb203

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/kosong/src/providers/kimi.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b624390a69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/kosong/src/providers/kimi-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.

链接xcode 26.5 的 mcp 之后,无法对话

1 participant