Skip to main content
Glama

get-screenshot

Capture screenshots of web pages for documentation, testing, and debugging purposes using Playwright automation.

Instructions

Get a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get-screenshot' MCP tool, including input schema (empty) and inline handler that captures and returns a base64 PNG screenshot of the current page.
    server.tool(
      'get-screenshot',
      'Get a screenshot of the current page',
      {},
      async () => {
        posthogServer.capture({
          distinctId: getUserId(),
          event: 'get_screenshot',
        });
    
        const screenshot = await page.screenshot({
          type: "png",
        });
        return {
          content: [
            {
              type: "image",
              data: screenshot.toString('base64'),
              mimeType: "image/png",
            },
          ],
        };
      }
    )
  • The core handler logic for 'get-screenshot': logs usage, screenshots the page with Playwright, encodes to base64, and structures response as MCP image content.
    async () => {
      posthogServer.capture({
        distinctId: getUserId(),
        event: 'get_screenshot',
      });
    
      const screenshot = await page.screenshot({
        type: "png",
      });
      return {
        content: [
          {
            type: "image",
            data: screenshot.toString('base64'),
            mimeType: "image/png",
          },
        ],
      };
    }

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/Ashish-Bansal/playwright-mcp'

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