screenshot
Capture page screenshots during automated web testing to document visual states and verify UI elements.
Instructions
Take a screenshot of the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the screenshot file (without extension) |
Implementation Reference
- src/browser.ts:83-89 (handler)The screenshot method in the BrowserManager class that captures a screenshot of the current page using Puppeteer and saves it to a file with the given name.
async screenshot(name: string) { const page = await this.init(); const filename = `${name.replace(/[^a-z0-9]/gi, '_').toLowerCase()}.png`; const filepath = path.resolve(process.cwd(), filename); await page.screenshot({ path: filepath }); return `Screenshot saved to ${filepath}`; } - src/index.ts:71-81 (schema)The input schema and metadata definition for the 'screenshot' tool, including name, description, and input parameters.
{ name: "screenshot", description: "Take a screenshot of the current page", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the screenshot file (without extension)" }, }, required: ["name"], }, }, - src/index.ts:132-134 (registration)The dispatch logic in the CallToolRequestSchema handler that routes 'screenshot' tool calls to the browserManager.screenshot method.
case "screenshot": result = await browserManager.screenshot(String(args?.name)); break;