Skip to main content
Glama

render.screenshot

Capture webpage screenshots for security testing and documentation during bug bounty hunting and vulnerability assessment.

Instructions

Take a screenshot of a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to screenshot
fullPageNoCapture full page
waitTimeNoWait time in ms before screenshot

Implementation Reference

  • The handler function for render.screenshot tool. Launches a headless Puppeteer browser, navigates to the URL, waits, takes a screenshot, saves it to screenshots/ directory, and returns the file path.
    async ({ url, fullPage = false, waitTime = 2000 }: any): Promise<ToolResult> => { let page: Page | null = null; try { const browserInstance = await getBrowser(); page = await browserInstance.newPage(); await page.setViewport({ width: 1920, height: 1080 }); await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 }); await new Promise(resolve => setTimeout(resolve, waitTime)); const screenshotsDir = path.join(process.cwd(), 'screenshots'); await fs.ensureDir(screenshotsDir); const filename = `screenshot_${Date.now()}.png`; const filepath = path.join(screenshotsDir, filename); await page.screenshot({ path: filepath, fullPage, }); await page.close(); return formatToolResult(true, { url, screenshot: filepath, filename, }); } catch (error: any) { if (page) await page.close().catch(() => {}); return formatToolResult(false, null, error.message); } }
  • Input schema defining parameters for the render.screenshot tool: url (required), fullPage, waitTime.
    inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to screenshot' }, fullPage: { type: 'boolean', description: 'Capture full page', default: false }, waitTime: { type: 'number', description: 'Wait time in ms before screenshot', default: 2000 }, }, required: ['url'], },
  • Registers the render.screenshot tool on the MCP server with description, input schema, and handler function.
    server.tool( 'render.screenshot', { description: 'Take a screenshot of a webpage', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to screenshot' }, fullPage: { type: 'boolean', description: 'Capture full page', default: false }, waitTime: { type: 'number', description: 'Wait time in ms before screenshot', default: 2000 }, }, required: ['url'], }, }, async ({ url, fullPage = false, waitTime = 2000 }: any): Promise<ToolResult> => { let page: Page | null = null; try { const browserInstance = await getBrowser(); page = await browserInstance.newPage(); await page.setViewport({ width: 1920, height: 1080 }); await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 }); await new Promise(resolve => setTimeout(resolve, waitTime)); const screenshotsDir = path.join(process.cwd(), 'screenshots'); await fs.ensureDir(screenshotsDir); const filename = `screenshot_${Date.now()}.png`; const filepath = path.join(screenshotsDir, filename); await page.screenshot({ path: filepath, fullPage, }); await page.close(); return formatToolResult(true, { url, screenshot: filepath, filename, }); } catch (error: any) { if (page) await page.close().catch(() => {}); return formatToolResult(false, null, error.message); } } );
  • src/index.ts:42-42 (registration)
    Top-level call to registerRenderTools which includes the render.screenshot tool among others.
    registerRenderTools(server);
  • Helper function to lazily initialize and return the Puppeteer browser instance used by render tools.
    async function getBrowser(): Promise<Browser> { if (!browser) { browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'], }); } return browser; }

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/telmon95/VulneraMCP'

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