From 0613c5f532f9412f757d1a6cfb1bc18ac21bfa69 Mon Sep 17 00:00:00 2001 From: Frank Gonnello Date: Wed, 11 Feb 2026 09:53:46 -0500 Subject: [PATCH] feat: add fullPage parameter to browser_screenshot Playwright's page.screenshot() supports a fullPage option to capture the entire scrollable page, but BrowserMCP doesn't expose it. This adds an optional boolean parameter (defaults to false) to the screenshot tool's schema and passes it through to the browser extension via the socket message. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/tools/custom.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tools/custom.ts b/src/tools/custom.ts index afaffe4..ab56644 100644 --- a/src/tools/custom.ts +++ b/src/tools/custom.ts @@ -1,9 +1,20 @@ +import { z } from "zod"; import { zodToJsonSchema } from "zod-to-json-schema"; import { GetConsoleLogsTool, ScreenshotTool } from "@repo/types/mcp/tool"; import { Tool } from "./tool"; +const ScreenshotToolArgs = ScreenshotTool.shape.arguments.extend({ + fullPage: z + .boolean() + .optional() + .default(false) + .describe( + "Whether to capture the full scrollable page instead of just the visible viewport", + ), +}); + export const getConsoleLogs: Tool = { schema: { name: GetConsoleLogsTool.shape.name.value, @@ -28,12 +39,13 @@ export const screenshot: Tool = { schema: { name: ScreenshotTool.shape.name.value, description: ScreenshotTool.shape.description.value, - inputSchema: zodToJsonSchema(ScreenshotTool.shape.arguments), + inputSchema: zodToJsonSchema(ScreenshotToolArgs), }, - handle: async (context, _params) => { + handle: async (context, params) => { + const { fullPage } = ScreenshotToolArgs.parse(params); const screenshot = await context.sendSocketMessage( "browser_screenshot", - {}, + { fullPage } as any, ); return { content: [