get-screenshot
Capture screenshots of web pages for documentation, testing, and debugging purposes using Playwright automation.
Instructions
Get a screenshot of the current page
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-screenshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/index.ts:165-188 (registration)Registration of the 'get-screenshot' MCP tool, including input schema (empty) and inline handler that captures and returns a base64 PNG screenshot of the current page.
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 core handler logic for 'get-screenshot': logs usage, screenshots the page with Playwright, encodes to base64, and structures response as MCP image content.
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", }, ], }; }