screenshot_full_page
Capture the entire webpage, including off-screen content, by automatically scrolling and stitching screenshots together.
Instructions
Take a screenshot of the ENTIRE page, including content you need to scroll down to see. Automatically scrolls and stitches images together. Use this when you need to see everything on the page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Image format: png (default, lossless) or jpeg (smaller file size) | |
| quality | No | JPEG quality 0-100 (higher = better quality, larger file) | |
| tabId | No | Target tab ID (defaults to currently active tab) | |
| apiKey | No | API key for authentication if enabled |
Implementation Reference
- src/tools/screenshot.ts:38-67 (handler)The handler function for the 'screenshot_full_page' MCP tool. It sends a 'screenshot_full_page' command via WebSocket bridge with optional format/quality params, handles errors, and returns an image content response.
server.tool( 'screenshot_full_page', 'Take a screenshot of the ENTIRE page, including content you need to scroll down to see. Automatically scrolls and stitches images together. Use this when you need to see everything on the page.', { format: z.enum(['png', 'jpeg']).optional().describe('Image format: png (default, lossless) or jpeg (smaller file size)'), quality: z.number().min(0).max(100).optional().describe('JPEG quality 0-100 (higher = better quality, larger file)'), tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, async ({ format, quality, tabId, apiKey }) => { const result = await bridge.sendCommand({ command: 'screenshot_full_page', params: { format, quality }, tabId, apiKey, timeout: LONG_TIMEOUT, }); if (!result.success) { return { content: [{ type: 'text', text: `Error: ${result.error?.message}` }], isError: true }; } const data = result.data as { image: string; mimeType: string }; return { content: [{ type: 'image', data: data.image, mimeType: data.mimeType, }], }; } ); - src/tools/screenshot.ts:41-46 (schema)Input schema/validation for the screenshot_full_page tool using Zod. Defines optional parameters: format (png/jpeg), quality (0-100), tabId (number), and apiKey (string).
{ format: z.enum(['png', 'jpeg']).optional().describe('Image format: png (default, lossless) or jpeg (smaller file size)'), quality: z.number().min(0).max(100).optional().describe('JPEG quality 0-100 (higher = better quality, larger file)'), tabId: z.number().optional().describe('Target tab ID (defaults to currently active tab)'), apiKey: z.string().optional().describe('API key for authentication if enabled'), }, - src/tools/index.ts:33-33 (registration)The tool is registered via registerScreenshotTools called from registerAllTools in src/tools/index.ts.
registerScreenshotTools(server, bridge); - src/server.ts:11-11 (registration)The createServer function calls registerAllTools to register all tools including screenshot_full_page on the MCP server.
registerAllTools(server, bridge); - src/websocket-bridge.ts:63-103 (helper)The WebSocketBridge.sendCommand helper used to relay the 'screenshot_full_page' command to the Chrome extension via WebSocket.
async sendCommand(cmd: BridgeCommand): Promise<BridgeResponse> { if (!this.isConnected()) { return { success: false, error: { code: 'NOT_CONNECTED', message: 'Chrome extension is not connected. Ensure the extension is installed, enabled, and the browser is running.', }, }; } const id = crypto.randomUUID(); const timeout = cmd.timeout ?? DEFAULT_TIMEOUT; return new Promise<BridgeResponse>((resolve, reject) => { const timer = setTimeout(() => { this.pending.delete(id); resolve({ success: false, error: { code: 'TIMEOUT', message: `Command '${cmd.command}' timed out after ${timeout}ms`, }, }); }, timeout); this.pending.set(id, { resolve, reject, timer }); const message = { id, type: 'request', command: cmd.command, params: cmd.params, tabId: cmd.tabId, apiKey: cmd.apiKey, timestamp: Date.now(), }; this.client!.send(JSON.stringify(message)); }); }