Skip to main content
Glama
AdsPower

AdsPower LocalAPI MCP Server

Official

screenshot

Capture browser page screenshots using AdsPower LocalAPI, specifying save paths and full-page options for documentation or analysis.

Instructions

Get the screenshot of the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
savePathNoThe path to save the screenshot
isFullPageNoThe is full page of the screenshot

Implementation Reference

  • The main handler function for the 'screenshot' tool. It captures a screenshot of the current browser page using Playwright, optionally saves it to a file, converts it to base64, stores it in the browser's screenshots map, and returns the image data.
    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' }]; },
  • Zod schema defining the input parameters for the screenshot tool: optional savePath (string) and isFullPage (boolean).
    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(),
  • Registers the 'screenshot' tool with the MCP server using server.tool(), providing the tool name, description, input schema, and the wrapped handler function.
    server.tool('screenshot', 'Get the screenshot of the page', schemas.screenshotSchema.shape, wrapHandler(automationHandlers.screenshot));
  • Getter for the screenshots Map instance used by the handler to store base64 screenshot data keyed by filename.
    get screenshotsInstance() { return this.screenshots; }
  • Helper function to retrieve a stored screenshot by filename from the browser's screenshots map (used in commented resource code).
    export const getScreenshot = (filename: string) => { return browser.screenshotsInstance.get(filename); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AdsPower/local-api-mcp-typescript'

If you have feedback or need assistance with the MCP directory API, please join our Discord server