fix(mcp): unblock Kimi models in OpenCode with preview tools
I ran into OpenCode failing every turn with Kimi K3 when T3 Code exposed the preview_navigate MCP tool.
It was caused by the shared URL validator and the concrete field each adding a different description. Effect emitted both in allOf, and Kimi rejects them when flattening the schema.
The fix is to keep BoundedUrl validation-only and merge the shared URL guidance into each concrete field description. Effect changes the generated schema from:
{
"type": "string",
"allOf": [
{
"pattern": "^\\S[\\s\\S]*\\S$|^\\S$|^$"
},
{
"minLength": 1,
"description": "Absolute http(s) URL or a schemeless host such as t3.chat or localhost:5173. Schemeless public hosts use https; loopback hosts use http."
},
{
"maxLength": 2048,
"description": "Direct website URL."
}
]
}
to:
{
"type": "string",
"allOf": [
{
"pattern": "^\\S[\\s\\S]*\\S$|^\\S$|^$"
},
{
"minLength": 1
},
{
"maxLength": 2048,
"description": "Direct website URL. Absolute http(s) URL or a schemeless host such as t3.chat or localhost:5173. Schemeless public hosts use https; loopback hosts use http."
}
]
}
minLength, maxLength, and URL validation are unchanged. Only the descriptions are consolidated. Tested with vp test run apps/server/src/mcp/toolkits/preview/tools.test.ts.
[!NOTE] Low Risk Contract/schema annotation only; URL validation is unchanged and coverage is added for
preview_navigateschema shape.Overview Fixes OpenCode failures with Kimi K3 when
preview_navigate(and related preview MCP tools) expose URL fields whose Effect JSON schema had more than onedescriptioninsideallOf. Kimi rejects that shape when flattening tool schemas.
BoundedUrlis now validation-only (trim, non-empty, max length) with no description on the sharedisNonEmpty()check. Shared URL format guidance lives inURL_GUIDANCEand is inlined into each concrete field description onPreviewAutomationOpenInput,PreviewAutomationNavigateInput, andBrowserNavigationTargetURL fields.A regression test in
tools.test.tsassertspreview_navigatenever emits schemas with multiple describedallOfmembers. URL validation rules are unchanged; only how descriptions are attached to the generated JSON schema.Reviewed by Cursor Bugbot for commit 63628e64d89c113ae14b92ae5884ac1d9dd6639c. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Fix Kimi model compatibility by removing multiple
allOfdescriptions frompreview_navigateschema
- Moves URL format guidance into a shared
URL_GUIDANCEconstant and inlines it into theurlfield descriptions forPreviewAutomationNavigateInput,PreviewAutomationOpenInput, andBrowserNavigationTargetin previewAutomation.ts.- Removes the description from the
BoundedUrlisNonEmpty()check to avoid generating multiple describedallOfmembers in the compiled JSON schema, which Kimi models reject.- Adds a
schemaHasMultipleAllOfDescriptionshelper in tools.test.ts and asserts thatpreview_navigatenever produces such a schema.Macroscope summarized 63628e6.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
521f0b75-0959-4bfa-8d0c-ecc0b553fb33You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
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.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved a9be6ba
This PR restructures schema descriptions to avoid duplicate descriptions in allOf arrays, fixing compatibility with certain AI model providers. The changes are purely metadata/documentation with no impact on runtime validation logic.
You can customize Macroscope's approvability policy. Learn more.
confirmed: keeping both descriptions is semantically reasonable, but Effect emits them as separate described members inside allOf, which Kimi rejects. consolidating the shared guidance into each concrete field description is the right fix here; validation and guidance are preserved. no change requested.