Skip to content

Commit 1f0a14c

Browse files
refactor(server): classify preview toolkit exports (pingdotgg#10281)
1 parent 7cdeb69 commit 1f0a14c

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

‎apps/server/src/mcp/toolkits/preview/handlers.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,3 @@ export const PreviewStandardToolkitHandlersLive = PreviewStandardToolkit.toLayer
200200
export const PreviewSnapshotToolkitHandlersLive = PreviewSnapshotToolkit.toLayer({
201201
preview_snapshot,
202202
});
203-
204-
export const PreviewToolkitHandlersLive = PreviewToolkit.toLayer(handlers);

‎apps/server/src/mcp/toolkits/preview/tools.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const safeBrowserTool = <T extends Tool.Any>(tool: T): T =>
4747
const readonlyBrowserTool = <T extends Tool.Any>(tool: T): T =>
4848
safeBrowserTool(tool).annotate(Tool.Readonly, true).annotate(Tool.Idempotent, true) as T;
4949

50-
export const PreviewStatusTool = Tool.make("preview_status", {
50+
const PreviewStatusTool = Tool.make("preview_status", {
5151
description:
5252
"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.",
5353
parameters: PreviewAutomationTabTargetInput,
@@ -60,7 +60,7 @@ export const PreviewStatusTool = Tool.make("preview_status", {
6060
.annotate(Tool.Destructive, false)
6161
.annotate(Tool.Idempotent, true);
6262

63-
export const PreviewOpenTool = browserTool(
63+
const PreviewOpenTool = browserTool(
6464
Tool.make("preview_open", {
6565
description:
6666
"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(
7373
.annotate(Tool.Destructive, false),
7474
);
7575

76-
export const PreviewNavigateTool = safeBrowserTool(
76+
const PreviewNavigateTool = safeBrowserTool(
7777
Tool.make("preview_navigate", {
7878
description:
7979
"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(
8484
}).annotate(Tool.Title, "Navigate browser preview"),
8585
);
8686

87-
export const PreviewResizeTool = safeBrowserTool(
87+
const PreviewResizeTool = safeBrowserTool(
8888
Tool.make("preview_resize", {
8989
description:
9090
"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(
9797
.annotate(Tool.Idempotent, true),
9898
);
9999

100-
export const PreviewSetAppearanceTool = safeBrowserTool(
100+
const PreviewSetAppearanceTool = safeBrowserTool(
101101
Tool.make("preview_set_appearance", {
102102
description:
103103
"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(
129129
}).annotate(Tool.Title, "Inspect browser page"),
130130
);
131131

132-
export const PreviewClickTool = browserTool(
132+
const PreviewClickTool = browserTool(
133133
Tool.make("preview_click", {
134134
description:
135135
"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(
140140
}).annotate(Tool.Title, "Click preview page"),
141141
);
142142

143-
export const PreviewTypeTool = browserTool(
143+
const PreviewTypeTool = browserTool(
144144
Tool.make("preview_type", {
145145
description:
146146
"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(
151151
}).annotate(Tool.Title, "Type into preview page"),
152152
);
153153

154-
export const PreviewPressTool = browserTool(
154+
const PreviewPressTool = browserTool(
155155
Tool.make("preview_press", {
156156
description:
157157
"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(
162162
}).annotate(Tool.Title, "Press key in preview page"),
163163
);
164164

165-
export const PreviewScrollTool = safeBrowserTool(
165+
const PreviewScrollTool = safeBrowserTool(
166166
Tool.make("preview_scroll", {
167167
description:
168168
"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(
173173
}).annotate(Tool.Title, "Scroll preview page"),
174174
);
175175

176-
export const PreviewEvaluateTool = browserTool(
176+
const PreviewEvaluateTool = browserTool(
177177
Tool.make("preview_evaluate", {
178178
description:
179179
"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(
184184
}).annotate(Tool.Title, "Evaluate JavaScript in preview"),
185185
);
186186

187-
export const PreviewWaitForTool = readonlyBrowserTool(
187+
const PreviewWaitForTool = readonlyBrowserTool(
188188
Tool.make("preview_wait_for", {
189189
description:
190190
"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(
195195
}).annotate(Tool.Title, "Wait for preview page condition"),
196196
);
197197

198-
export const PreviewRecordingStartTool = safeBrowserTool(
198+
const PreviewRecordingStartTool = safeBrowserTool(
199199
Tool.make("preview_recording_start", {
200200
description:
201201
"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(
206206
}).annotate(Tool.Title, "Start browser recording"),
207207
);
208208

209-
export const PreviewRecordingStopTool = safeBrowserTool(
209+
const PreviewRecordingStopTool = safeBrowserTool(
210210
Tool.make("preview_recording_stop", {
211211
description:
212212
"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.",

0 commit comments

Comments
 (0)