Skip to main content
Glama

screenshot

Capture browser screenshots during automated web testing to document page states and verify visual elements.

Instructions

Take a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the screenshot file (without extension)

Implementation Reference

  • The handler function that performs the screenshot operation using Puppeteer on the current page, sanitizes the filename, saves the PNG to the current working directory, and returns the saved path.
    async screenshot(name: string) { const page = await this.init(); const filename = `${name.replace(/[^a-z0-9]/gi, '_').toLowerCase()}.png`; const filepath = path.resolve(process.cwd(), filename); await page.screenshot({ path: filepath }); return `Screenshot saved to ${filepath}`; }
  • Defines the JSON schema for the screenshot tool input, requiring a 'name' string parameter.
    inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the screenshot file (without extension)" }, }, required: ["name"], },
  • src/index.ts:71-81 (registration)
    Registers the screenshot tool in the TOOLS array used by the ListToolsRequestSchema handler.
    { name: "screenshot", description: "Take a screenshot of the current page", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the screenshot file (without extension)" }, }, required: ["name"], }, },
  • src/index.ts:132-134 (registration)
    Dispatches the screenshot tool call in the CallToolRequestSchema switch statement by invoking browserManager.screenshot.
    case "screenshot": result = await browserManager.screenshot(String(args?.name)); break;

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/samusilv/qa-agent-mcp'

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