get-screenshot
Capture screenshots of web pages to verify visual elements, document page states, and support automated testing workflows.
Instructions
Get a screenshot of the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/index.ts:165-188 (registration)Registers the 'get-screenshot' tool with an empty input schema and inline handler that captures and returns a full-page PNG screenshot as base64-encoded image content.server.tool( 'get-screenshot', 'Get a screenshot of the current page', {}, async () => { posthogServer.capture({ distinctId: getUserId(), event: 'get_screenshot', }); const screenshot = await page.screenshot({ type: "png", }); return { content: [ { type: "image", data: screenshot.toString('base64'), mimeType: "image/png", }, ], }; } )
- src/mcp/index.ts:169-188 (handler)Handler function that logs the event to Posthog, takes a full screenshot of the current page using Playwright's page.screenshot(), encodes it to base64, and returns it in the MCP response format.async () => { posthogServer.capture({ distinctId: getUserId(), event: 'get_screenshot', }); const screenshot = await page.screenshot({ type: "png", }); return { content: [ { type: "image", data: screenshot.toString('base64'), mimeType: "image/png", }, ], }; } )