Skip to main content
Glama

screenshot

Capture and save the current webpage as an image. Use the tool to specify file names and choose between full-page or partial captures, ideal for documentation or testing purposes.

Instructions

Take a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullPageNoCapture full page
nameNoName for the screenshot filescreenshot.png

Implementation Reference

  • Main handler implementation for the 'screenshot' MCP tool. Captures screenshot using Chrome DevTools Protocol (Page.captureScreenshot), handles full-page option, saves base64 data to /tmp/{name}, and returns the file path.
    async screenshot(name = 'screenshot.png', fullPage = false) { await this.ensureChromium(); const screenshotParams = { format: 'png' }; if (fullPage) { const metrics = await this.sendCDPCommand('Page.getLayoutMetrics'); await this.sendCDPCommand('Emulation.setDeviceMetricsOverride', { width: metrics.contentSize.width, height: metrics.contentSize.height, deviceScaleFactor: 1, mobile: false, }); screenshotParams.clip = { x: 0, y: 0, width: metrics.contentSize.width, height: metrics.contentSize.height, scale: 1, }; } const screenshot = await this.sendCDPCommand('Page.captureScreenshot', screenshotParams); const screenshotPath = `/tmp/${name}`; fs.writeFileSync(screenshotPath, screenshot.data, 'base64'); return { content: [{ type: 'text', text: `Screenshot saved to ${screenshotPath}` }], }; }
  • Tool registration in ListToolsRequestSchema handler. Defines name 'screenshot', description, and input schema with optional 'name' (string, default 'screenshot.png') and 'fullPage' (boolean, default false).
    { name: 'screenshot', description: 'Take a screenshot of the current page', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the screenshot file', default: 'screenshot.png', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, }, }, },
  • Input schema definition for the 'screenshot' tool validation.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the screenshot file', default: 'screenshot.png', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, }, },
  • Dispatch handler in CallToolRequestSchema that routes 'screenshot' tool calls to the main screenshot method.
    return await this.screenshot(args.name, args.fullPage); case 'evaluate':

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/nfodor/claude-arm64-browser'

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