Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): text-only browser snapshots skip the PNG encode (66 ms → 20 ms median) #30305

MergedYuruzuu(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/30305/headmerged by juliusmarminge View on GitHub

Showing 8 changed files with 35 additions and 9 deletions (loading 5).

x
0 of 8 viewed, 8 left
10 additions and 5 deletionsapps/server/src/mcp/toolkits/preview/handlers.tsModified
View file
@@ -18,6 +18,7 @@
type PreviewAutomationResizeResult,
type PreviewAutomationSetColorSchemeResult,
type PreviewAutomationSnapshot,
+ type PreviewAutomationSnapshotMetadata,
type PreviewAutomationStatus,
type PreviewTabId,
} from "@t3tools/contracts";
@@ -221,12 +222,16 @@
invokeTargeted<PreviewAutomationSetColorSchemeResult>("setColorScheme", input),
preview_snapshot: McpToolAccess.readsAsCaller((input) => {
- const { includeImage: _includeImage, save, ...operationInput } = input ?? {};
+ const { includeImage, save, ...operationInput } = input ?? {};
// The saved file is for people, so it keeps the resolution the agent's image is capped below.
- return invokeTargeted<PreviewAutomationSnapshot>("snapshot", {
- ...operationInput,
- ...(save === true ? { fullScreenshot: true } : {}),
- });
+ return invokeTargeted<PreviewAutomationSnapshot | PreviewAutomationSnapshotMetadata>(
+ "snapshot",
+ {
+ ...operationInput,
+ ...(save === true ? { fullScreenshot: true } : {}),
+ ...(includeImage === true || save === true ? {} : { pixelsRequired: false }),
+ },
+ );
}),
preview_act: McpToolAccess.actsAsCaller(({ action, ...input }) =>