@devries-cameron20 / t3code Mirror · read-only / commits / 3d429662c9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 19:00 UTC

fix(mcp): unblock Kimi models in OpenCode with preview tools (#5128)

Hwanseo Choi committed Aug 5, 2026 at 12:03 UTC 3d429662c9bd7b731c059dc3a84ccdfc43bf3701
2 files changed +22 -11
apps/server/src/mcp/toolkits/preview/tools.test.ts
+16
@@ -12,6 +12,19 @@ const schemaHasDescription = (schema: unknown): boolean => {
12 .some((members) => members.some(schemaHasDescription));
13 };
14
15 +const schemaHasMultipleAllOfDescriptions = (schema: unknown): boolean => {
16 + if (!schema || typeof schema !== "object") return false;
17 + const record = schema as Record<string, unknown>;
18 + const allOf = Array.isArray(record.allOf) ? record.allOf : [];
19 + const descriptionCount = allOf.filter(
20 + (member) =>
21 + member !== null &&
22 + typeof member === "object" &&
23 + typeof (member as Record<string, unknown>).description === "string",
24 + ).length;
25 + return descriptionCount > 1 || Object.values(record).some(schemaHasMultipleAllOfDescriptions);
26 +};
27 +
28 it("exports provider-compatible object schemas with described parameters", () => {
29 for (const tool of Object.values(PreviewToolkit.tools)) {
30 const schema = Tool.getJsonSchema(tool) as {
@@ -27,6 +40,9 @@ it("exports provider-compatible object schemas with described parameters", () =>
40 expect(schema.type, `${tool.name} must export a top-level object schema`).toBe("object");
41 expect(schema.anyOf, `${tool.name} must not export a root anyOf`).toBeUndefined();
42 expect(schema.oneOf, `${tool.name} must not export a root oneOf`).toBeUndefined();
43 + if (tool.name === "preview_navigate") {
44 + expect(schemaHasMultipleAllOfDescriptions(schema)).toBe(false);
45 + }
46 expect(
47 schema.properties?.tabId,
48 `${tool.name} must allow an explicit collaborative browser tab target`,
packages/contracts/src/previewAutomation.ts
+6 -11
@@ -12,13 +12,10 @@ import {
12 import { ProviderInstanceId } from "./providerInstance.ts";
13
14 const BoundedUrl = Schema.String.check(Schema.isTrimmed())
15 - .check(
16 - Schema.isNonEmpty({
17 - description:
18 - "Absolute http(s) URL or a schemeless host such as t3.chat or localhost:5173. Schemeless public hosts use https; loopback hosts use http.",
19 - }),
20 - )
15 + .check(Schema.isNonEmpty())
16 .check(Schema.isMaxLength(2048));
17 +const URL_GUIDANCE =
18 + "Absolute http(s) URL or a schemeless host such as t3.chat or localhost:5173. Schemeless public hosts use https; loopback hosts use http.";
19 const OptionalTimeoutMs = Schema.optional(
20 Schema.Int.check(Schema.isGreaterThan(0))
21 .check(Schema.isLessThanOrEqualTo(60_000))
@@ -83,8 +80,7 @@ export type PreviewAutomationStatus = typeof PreviewAutomationStatus.Type;
80 export const PreviewAutomationOpenInput = Schema.Struct({
81 ...PreviewAutomationTabTargetFields,
82 url: Schema.optional(BoundedUrl).annotate({
86 - description:
87 - "Optional initial page URL, for example https://t3.chat or localhost:5173. Omit to open a blank tab.",
83 + description: `Optional initial page URL. ${URL_GUIDANCE} Omit to open a blank tab.`,
84 }),
85 open: Schema.optional(
86 Schema.Boolean.annotate({
@@ -124,7 +120,7 @@ export const BrowserNavigationTarget = Schema.Union([
120 description: "Selects direct URL navigation.",
121 }),
122 url: BoundedUrl.annotate({
127 - description: "Direct website URL.",
123 + description: `Direct website URL. ${URL_GUIDANCE}`,
124 }),
125 }),
126 Schema.Struct({
@@ -151,8 +147,7 @@ export type BrowserNavigationTarget = typeof BrowserNavigationTarget.Type;
147 export const PreviewAutomationNavigateInput = Schema.Struct({
148 ...PreviewAutomationTabTargetFields,
149 url: Schema.optional(BoundedUrl).annotate({
154 - description:
155 - "Website URL, for example https://t3.chat. Use this for public pages and directly reachable URLs.",
150 + description: `Website URL. ${URL_GUIDANCE} Use this for public pages and directly reachable URLs.`,
151 }),
152 target: Schema.optional(
153 BrowserNavigationTarget.annotate({