Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): bound preview_snapshot metadata sent to the agent #9505

Closedylcn91(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/9505/headopened View on GitHub

Showing 4 changed files with 198 additions and 2 deletions (loading 2).

x
0 of 4 viewed, 4 left
1 addition and 1 deletionapps/server/src/mcp/toolkits/preview/tools.tsModified
View file
@@ -111,7 +111,7 @@
export const PreviewSnapshotTool = readonlyBrowserTool(
Tool.make("preview_snapshot", {
description:
- "Inspect a page before interacting. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab. Returns page state, semantic elements, diagnostics, action history, and a PNG screenshot.",
+ "Inspect a page before interacting. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab. Returns page state, semantic elements, diagnostics, action history, and a PNG screenshot. On very large pages the metadata is reduced to fit a size limit, least useful fields first, and `truncation` lists what was omitted or trimmed.",
parameters: PreviewAutomationTabTargetInput,
success: PreviewAutomationSnapshot,
failure: PreviewAutomationError,
197 additions and 1 deletionapps/server/src/mcp/McpHttpServer.test.tsModified
View file
@@ -1,9 +1,17 @@
import { expect, it } from "@effect/vitest";
import { NodeHttpServer } from "@effect/platform-node";
import * as NodeServices from "@effect/platform-node/NodeServices";
-import { EnvironmentId, PreviewTabId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
+import {
+ EnvironmentId,
+ PreviewTabId,
+ ProviderInstanceId,
+ ThreadId,
+ type PreviewAutomationElement,
+ type PreviewAutomationSnapshot,
+} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
+import * as Schema from "effect/Schema";
import * as Stream from "effect/Stream";
import { McpProtocol, McpSchema, McpServer } from "effect/unstable/ai";