Skip to main content
Glama
epi-builder
by epi-builder

browser_take_screenshot

Capture screenshots of web pages using Playwright browser automation. Save images with custom filenames and choose between viewport or full-page captures.

Instructions

Take a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoFile name to save the screenshot to
fullPageNoTake screenshot of full page

Implementation Reference

  • The handler function that executes the browser_take_screenshot tool. It ensures a browser and page are available, saves a screenshot to the specified filename (or a timestamped default), optionally full page, and returns a success message.
    private async handleScreenshot(filename?: string, fullPage?: boolean) {
      await this.ensureBrowser();
      
      const screenshotPath = filename || `screenshot-${Date.now()}.png`;
      await this.browserState.page!.screenshot({
        path: screenshotPath,
        fullPage: fullPage || false,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: `Screenshot saved to ${screenshotPath}`,
          },
        ],
      };
    }
  • The tool schema definition returned by listTools, including name, description, and inputSchema for filename (optional string) and fullPage (optional boolean).
    {
      name: 'browser_take_screenshot',
      description: 'Take a screenshot of the current page',
      inputSchema: {
        type: 'object',
        properties: {
          filename: {
            type: 'string',
            description: 'File name to save the screenshot to',
          },
          fullPage: {
            type: 'boolean',
            description: 'Take screenshot of full page',
          },
        },
      },
    },
  • src/server.ts:169-171 (registration)
    The switch case registration that maps the tool name to its handler function in the CallToolRequest handler.
    case 'browser_take_screenshot':
      return await this.handleScreenshot(args?.filename as string | undefined, args?.fullPage as boolean | undefined);

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/epi-builder/mcp-test'

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