Skip to main content
Glama

screenshot_page

Capture web page screenshots for documentation, testing, or visual reference by providing a URL, with options for full-page capture and element waiting.

Instructions

Take a screenshot of a web page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to screenshot
fullPageNoCapture full page
waitForSelectorNoCSS selector to wait for before screenshot

Implementation Reference

  • Core implementation of screenshotPage using Playwright: launches browser, navigates to URL, waits for selector if provided, takes screenshot, returns Buffer.
    async screenshotPage(config: ScrapingConfig, options?: { fullPage?: boolean; path?: string }): Promise<Buffer> { const browser = await this.getBrowser(); const page = await browser.newPage(); try { await page.goto(config.url, { waitUntil: 'networkidle', timeout: config.timeout || 30000, }); if (config.waitForSelector) { await page.waitForSelector(config.waitForSelector); } const screenshot = await page.screenshot({ fullPage: options?.fullPage || false, path: options?.path, }); return screenshot as Buffer; } finally { await page.close(); } }
  • MCP tool handler switch case for 'screenshot_page': calls DynamicScraper.screenshotPage and returns base64-encoded PNG.
    case 'screenshot_page': { const screenshot = await dynamicScraper.screenshotPage(config, { fullPage: params.fullPage as boolean, }); return { screenshot: screenshot.toString('base64'), format: 'png', message: 'Screenshot taken successfully', }; }
  • Registers the 'screenshot_page' tool in webScrapingTools array, including description and input schema.
    { name: 'screenshot_page', description: 'Take a screenshot of a web page', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to screenshot', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, waitForSelector: { type: 'string', description: 'CSS selector to wait for before screenshot', }, }, required: ['url'], }, },
  • Input schema for the screenshot_page tool defining parameters: url (required), fullPage, waitForSelector.
    inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to screenshot', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, waitForSelector: { type: 'string', description: 'CSS selector to wait for before screenshot', }, }, required: ['url'], }, },

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/code-alchemist01/development-tools-mcp-Server'

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