The best way to control Claude Code, Codex and more from any computer or phone
refactor(server): classify preview toolkit exports (#10281)
Julius Marminge committed
Sep 8, 2026 at 01:17 UTC
1f0a14cf7f1bb1b6167fca475e9b7183bc8ec8af
2 files changed
+13
-15
apps/server/src/mcp/toolkits/preview/handlers.ts
-2
@@ -200,5 +200,3 @@ export const PreviewStandardToolkitHandlersLive = PreviewStandardToolkit.toLayer
200
export const PreviewSnapshotToolkitHandlersLive = PreviewSnapshotToolkit.toLayer({
201
preview_snapshot,
202
});
203
-
204
-export const PreviewToolkitHandlersLive = PreviewToolkit.toLayer(handlers);
apps/server/src/mcp/toolkits/preview/tools.ts
+13
-13
@@ -47,7 +47,7 @@ const safeBrowserTool = <T extends Tool.Any>(tool: T): T =>
47
const readonlyBrowserTool = <T extends Tool.Any>(tool: T): T =>
48
safeBrowserTool(tool).annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true) as T;
49
50
-export const PreviewStatusTool = Tool.make("preview_status", {
50
+const PreviewStatusTool = Tool.make("preview_status", {
51
description:
52
"Report whether a collaborative browser tab is automation-capable, including its URL, title, visibility, loading state, viewport mode, and measured CSS-pixel size. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab.",
53
parameters: PreviewAutomationTabTargetInput,
@@ -60,7 +60,7 @@ export const PreviewStatusTool = Tool.make("preview_status", {
60
.annotate(Tool.Destructive, false)
61
.annotate(Tool.Idempotent, true);
62
63
-export const PreviewOpenTool = browserTool(
63
+const PreviewOpenTool = browserTool(
64
Tool.make("preview_open", {
65
description:
66
"Initialize a collaborative browser tab and open its thread-bound inline preview by default. Set open=false for background-only automation. Pass tabId to reuse a specific existing tab, set reuseExistingTab=false to create another tab, or omit both to use this agent session's current tab.",
@@ -73,7 +73,7 @@ export const PreviewOpenTool = browserTool(
73
.annotate(Tool.Destructive, false),
74
);
75
76
-export const PreviewNavigateTool = safeBrowserTool(
76
+const PreviewNavigateTool = safeBrowserTool(
77
Tool.make("preview_navigate", {
78
description:
79
"Navigate a collaborative browser tab. Pass tabId to target a specific tab, plus {url:'https://t3.chat'} for a website or {target:{kind:'environment-port',port:5173}} for a dev server. Exactly one of url or target is required.",
@@ -84,7 +84,7 @@ export const PreviewNavigateTool = safeBrowserTool(
84
}).annotate(Tool.Title, "Navigate browser preview"),
85
);
86
87
-export const PreviewResizeTool = safeBrowserTool(
87
+const PreviewResizeTool = safeBrowserTool(
88
Tool.make("preview_resize", {
89
description:
90
"Resize a collaborative browser tab, optionally selected by tabId. Use {mode:'fill'}, {mode:'freeform',width:1024,height:768}, or {mode:'preset',preset:'iphone-12-pro',orientation:'portrait'}. This changes CSS layout breakpoints without changing the desktop browser user agent.",
@@ -97,7 +97,7 @@ export const PreviewResizeTool = safeBrowserTool(
97
.annotate(Tool.Idempotent, true),
98
);
99
100
-export const PreviewSetAppearanceTool = safeBrowserTool(
100
+const PreviewSetAppearanceTool = safeBrowserTool(
101
Tool.make("preview_set_appearance", {
102
description:
103
"Emulate prefers-color-scheme in a collaborative browser tab, optionally selected by tabId. Use {colorScheme:'dark'} or {colorScheme:'light'} to preview the page in that appearance, and {colorScheme:'system'} to clear the override and follow the OS appearance.",
@@ -129,7 +129,7 @@ export const PreviewSnapshotTool = readonlyBrowserTool(
129
}).annotate(Tool.Title, "Inspect browser page"),
130
);
131
132
-export const PreviewClickTool = browserTool(
132
+const PreviewClickTool = browserTool(
133
Tool.make("preview_click", {
134
description:
135
"Click exactly one target in the tab selected by tabId, or this agent session's current tab when omitted. Prefer a Playwright locator; selector accepts legacy CSS; x and y must be supplied together.",
@@ -140,7 +140,7 @@ export const PreviewClickTool = browserTool(
140
}).annotate(Tool.Title, "Click preview page"),
141
);
142
143
-export const PreviewTypeTool = browserTool(
143
+const PreviewTypeTool = browserTool(
144
Tool.make("preview_type", {
145
description:
146
"Insert literal text into one input in the tab selected by tabId, or this agent session's current tab when omitted. Prefer a Playwright locator; set clear=true to replace existing text.",
@@ -151,7 +151,7 @@ export const PreviewTypeTool = browserTool(
151
}).annotate(Tool.Title, "Type into preview page"),
152
);
153
154
-export const PreviewPressTool = browserTool(
154
+const PreviewPressTool = browserTool(
155
Tool.make("preview_press", {
156
description:
157
"Press one keyboard key in the tab selected by tabId, or this agent session's current tab when omitted. Examples: {key:'Enter'}, {key:'Escape'}, or {key:'a',modifiers:['Meta']}.",
@@ -162,7 +162,7 @@ export const PreviewPressTool = browserTool(
162
}).annotate(Tool.Title, "Press key in preview page"),
163
);
164
165
-export const PreviewScrollTool = safeBrowserTool(
165
+const PreviewScrollTool = safeBrowserTool(
166
Tool.make("preview_scroll", {
167
description:
168
"Scroll the tab selected by tabId, or this agent session's current tab when omitted. Positive deltaY scrolls down and positive deltaX scrolls right; a locator/selector targets a container.",
@@ -173,7 +173,7 @@ export const PreviewScrollTool = safeBrowserTool(
173
}).annotate(Tool.Title, "Scroll preview page"),
174
);
175
176
-export const PreviewEvaluateTool = browserTool(
176
+const PreviewEvaluateTool = browserTool(
177
Tool.make("preview_evaluate", {
178
description:
179
"Evaluate JavaScript in the tab selected by tabId, or this agent session's current tab when omitted. Returns a serializable result up to 64 KB; the expression may mutate page state.",
@@ -184,7 +184,7 @@ export const PreviewEvaluateTool = browserTool(
184
}).annotate(Tool.Title, "Evaluate JavaScript in preview"),
185
);
186
187
-export const PreviewWaitForTool = readonlyBrowserTool(
187
+const PreviewWaitForTool = readonlyBrowserTool(
188
Tool.make("preview_wait_for", {
189
description:
190
"Wait in the tab selected by tabId, or this agent session's current tab when omitted, until all supplied locator, selector, text, and URL conditions match.",
@@ -195,7 +195,7 @@ export const PreviewWaitForTool = readonlyBrowserTool(
195
}).annotate(Tool.Title, "Wait for preview page condition"),
196
);
197
198
-export const PreviewRecordingStartTool = safeBrowserTool(
198
+const PreviewRecordingStartTool = safeBrowserTool(
199
Tool.make("preview_recording_start", {
200
description:
201
"Start recording the collaborative browser tab selected by tabId, or this agent session's current tab when omitted.",
@@ -206,7 +206,7 @@ export const PreviewRecordingStartTool = safeBrowserTool(
206
}).annotate(Tool.Title, "Start browser recording"),
207
);
208
209
-export const PreviewRecordingStopTool = safeBrowserTool(
209
+const PreviewRecordingStopTool = safeBrowserTool(
210
Tool.make("preview_recording_stop", {
211
description:
212
"Stop recording the collaborative browser tab selected by tabId, or this agent session's current tab when omitted, and transfer the compressed recording once (up to 50 MiB) to an evidence file readable in this agent's environment. Returns its environment-local path after transfer succeeds.",