screenshot
Capture web page screenshots using the MCP Browser Server. Save specific sections or full scrollable pages, with optional custom save paths for efficient web automation and documentation.
Instructions
Take a screenshot of the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullPage | No | Capture full scrollable page | |
| path | No | Path to save screenshot (optional) |
Implementation Reference
- src/index.ts:519-542 (handler)Handler for the 'screenshot' tool. Validates input using ScreenshotSchema, captures screenshot of current page using Playwright's page.screenshot() with options fullPage and path, returns textual confirmation with buffer size or save path.case 'screenshot': { if (!currentPage) { throw new Error('No browser page available. Launch a browser first.'); } const params = ScreenshotSchema.parse(args); const buffer = await currentPage.screenshot({ fullPage: params.fullPage, path: params.path }); const result = params.path ? `Screenshot saved to: ${params.path}` : `Screenshot captured (${buffer.length} bytes)`; return { content: [ { type: 'text', text: result } ] }; }
- src/index.ts:39-42 (schema)Zod schema for screenshot tool inputs: fullPage (boolean, optional, defaults to false), path (string, optional).const ScreenshotSchema = z.object({ fullPage: z.boolean().default(false), path: z.string().optional() });
- src/index.ts:220-235 (registration)Tool registration in ListTools response: defines name 'screenshot', description, and inputSchema matching ScreenshotSchema.name: 'screenshot', description: 'Take a screenshot of the current page', inputSchema: { type: 'object', properties: { fullPage: { type: 'boolean', default: false, description: 'Capture full scrollable page' }, path: { type: 'string', description: 'Path to save screenshot (optional)' } } }