screenshot
Capture and save webpage screenshots using AdsPower LocalAPI MCP Server, with options to specify the save path and choose between full-page or partial snapshots for precise documentation or analysis.
Instructions
Get the screenshot of the page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isFullPage | No | The is full page of the screenshot | |
| savePath | No | The path to save the screenshot |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"isFullPage": {
"description": "The is full page of the screenshot",
"type": "boolean"
},
"savePath": {
"description": "The path to save the screenshot",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/handlers/automation.ts:28-40 (handler)The main handler function for the 'screenshot' tool. It checks browser connection, generates a unique filename, saves screenshot to optional path or default downloads, converts to base64, stores in browser.screenshotsInstance Map, and returns the image data as an array with type, data, and mimeType.async screenshot({ savePath, isFullPage }: ScreenshotParams) { browser.checkConnected(); const filename = `screenshot-${Date.now()}-${Math.random().toString(36).substring(2, 15)}.png`; const outputPath = path.join(savePath || defaultDownloadsPath, filename); const screenshot = await browser.pageInstance!.screenshot({ path: outputPath, fullPage: isFullPage }); const screenshotBase64 = screenshot.toString('base64'); browser.screenshotsInstance.set(filename, screenshotBase64); return [{ type: 'image' as const, data: screenshotBase64, mimeType: 'image/png' }]; },
- src/types/schemas.ts:177-180 (schema)Zod input schema for the screenshot tool, defining optional savePath (string) and isFullPage (boolean) parameters with descriptions.screenshotSchema: z.object({ savePath: z.string().optional().describe('The path to save the screenshot'), isFullPage: z.boolean().optional().describe('The is full page of the screenshot') }).strict(),
- src/utils/toolRegister.ts:59-60 (registration)MCP server tool registration for 'screenshot', providing description, input schema shape, and wrapped handler from automationHandlers.server.tool('screenshot', 'Get the screenshot of the page', schemas.screenshotSchema.shape, wrapHandler(automationHandlers.screenshot));