get-screenshot
Capture a screenshot of the current webpage for documentation, debugging, or testing purposes. Integrated with Playwright MCP server to streamline web page interactions and enhance development workflows.
Instructions
Get a screenshot of the current page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/mcp/index.ts:165-188 (registration)Registration of the 'get-screenshot' tool, including its inline handler function that captures a full-page PNG screenshot using Playwright's page.screenshot() and returns it as base64 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-187 (handler)The handler function for 'get-screenshot' tool: logs the event, takes a PNG screenshot of the current page, converts to base64, and returns as image content in MCP 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", }, ], }; }