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 core handler function for the render.screenshot tool. Launches a Puppeteer browser, creates a new page, sets viewport, navigates to the URL, waits, takes a screenshot (fullPage option), saves to screenshots directory with timestamp filename, and returns success with file details or error.
    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 for the render.screenshot tool defining the expected parameters: url (required string), fullPage (optional boolean), waitTime (optional number).
    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'], },
  • Registration of the render.screenshot tool using server.tool(), including name, description, inputSchema, and inline handler function. Called within registerRenderTools.
    '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); } } );
  • Helper function to lazily initialize and return a shared Puppeteer Browser instance used by all render tools, including screenshot.
    async function getBrowser(): Promise<Browser> { if (!browser) { browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'], }); } return browser; }
  • src/index.ts:42-42 (registration)
    Invocation of registerRenderTools(server) which registers the render.screenshot tool (and others) on the main MCP Server instance.
    registerRenderTools(server);

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