Skip to main content
Glama

screenshot

Capture the current webpage as an image for documentation, debugging, or visual reference purposes.

Instructions

Take a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoOptional filename for the screenshot

Implementation Reference

  • MCP tool handler for 'screenshot' tool. Receives filename parameter, calls browser.screenshot(), and returns success message with file path.
    handler: async ({ filename }) => {
      const path = await browser.screenshot(filename);
      return { success: true, message: `Screenshot saved to ${path}` };
    }
  • Input schema for screenshot tool. Accepts optional 'filename' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        filename: { type: 'string', description: 'Optional filename for the screenshot' }
      },
      required: []
    },
  • Core screenshot implementation in SimpleBrowser class. Ensures browser is launched, generates filename if not provided, takes screenshot with Playwright, returns path.
    async screenshot(filename) {
      await this.ensureLaunched();
      const path = filename || `screenshot-${Date.now()}.png`;
      await this.page.screenshot({ path });
      return path;
    }
  • tools.js:18-21 (registration)
    Includes all Playwright tools (including screenshot) from createPlaywrightTools into the main createTools() array via spread operator.
    const playwrightTools = createPlaywrightTools(browser);
    
    return [
      ...playwrightTools,
  • index.js:75-77 (registration)
    Creates complete tools list via createTools(browser) and registers generic MCP handlers (CallToolRequestSchema and ListToolsRequestSchema) that dispatch to individual tool handlers.
    const tools = createTools(browser);
    
    // Handle tool execution requests from MCP clients

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/zypin-testing/zypin-mcp'

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