Skip to main content
Glama

screenshot

Capture screenshots in Firefox using Playwright automation. Specify file path, tab ID, and full-page options for precise browser image capturing.

Instructions

Take a screenshot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullPageNo
pathNoscreenshot.png
tabIdNo

Implementation Reference

  • The handler function for the 'screenshot' MCP tool. It ensures the browser is running, extracts path and fullPage from arguments (with defaults), calls page.screenshot from Playwright, and returns a text confirmation.
    //   async screenshot(args = {}) {
    //     this.ensureBrowserRunning();
    //     const { path = 'screenshot.png', fullPage = false } = args;
        
    //     await this.page.screenshot({
    //       path,
    //       fullPage
    //     });
        
    //     return {
    //       content: [
    //         {
    //           type: 'text',
    //           text: `Screenshot saved to: ${path}`
    //         }
    //       ]
    //     };
    //   }
  • The schema definition for the 'screenshot' tool, including name, description, and inputSchema specifying optional path (default 'screenshot.png') and fullPage (default false) parameters.
    //             description: 'Take a screenshot of the current page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 path: {
    //                   type: 'string',
    //                   description: 'File path to save screenshot',
    //                   default: 'screenshot.png'
    //                 },
    //                 fullPage: {
    //                   type: 'boolean',
    //                   description: 'Capture full page',
    //                   default: false
    //                 }
    //               }
    //             }
  • index.js:247-248 (registration)
    Registration of the 'screenshot' tool handler in the switch statement within the CallToolRequestSchema request handler.
    //           case 'screenshot':
    //             return await this.screenshot(args);
  • index.js:35-226 (registration)
    The listTools response includes the 'screenshot' tool in the tools array (specific block at 135-152). This registers the tool's metadata for MCP clients.
    //         tools: [
    //           {
    //             name: 'launch_firefox',
    //             description: 'Launch Firefox browser',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 headless: {
    //                   type: 'boolean',
    //                   description: 'Run browser in headless mode',
    //                   default: false
    //                 },
    //                 url: {
    //                   type: 'string',
    //                   description: 'Initial URL to navigate to',
    //                   default: 'about:blank'
    //                 }
    //               }
    //             }
    //           },
    //           {
    //             name: 'navigate',
    //             description: 'Navigate to a URL',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 url: {
    //                   type: 'string',
    //                   description: 'URL to navigate to'
    //                 }
    //               },
    //               required: ['url']
    //             }
    //           },
    //           {
    //             name: 'click',
    //             description: 'Click on an element',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 selector: {
    //                   type: 'string',
    //                   description: 'CSS selector or text content to click'
    //                 },
    //                 coordinates: {
    //                   type: 'object',
    //                   properties: {
    //                     x: { type: 'number' },
    //                     y: { type: 'number' }
    //                   },
    //                   description: 'Click at specific coordinates (alternative to selector)'
    //                 }
    //               }
    //             }
    //           },
    //           {
    //             name: 'type_text',
    //             description: 'Type text into an input field',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 selector: {
    //                   type: 'string',
    //                   description: 'CSS selector of the input field'
    //                 },
    //                 text: {
    //                   type: 'string',
    //                   description: 'Text to type'
    //                 }
    //               },
    //               required: ['selector', 'text']
    //             }
    //           },
    //           {
    //             name: 'get_page_content',
    //             description: 'Get the HTML content of the current page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 selector: {
    //                   type: 'string',
    //                   description: 'CSS selector to get specific element content (optional)'
    //                 }
    //               }
    //             }
    //           },
    //           {
    //             name: 'get_page_text',
    //             description: 'Get the visible text content of the current page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 selector: {
    //                   type: 'string',
    //                   description: 'CSS selector to get specific element text (optional)'
    //                 }
    //               }
    //             }
    //           },
    //           {
    //             name: 'screenshot',
    //             description: 'Take a screenshot of the current page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 path: {
    //                   type: 'string',
    //                   description: 'File path to save screenshot',
    //                   default: 'screenshot.png'
    //                 },
    //                 fullPage: {
    //                   type: 'boolean',
    //                   description: 'Capture full page',
    //                   default: false
    //                 }
    //               }
    //             }
    //           },
    //           {
    //             name: 'wait_for_element',
    //             description: 'Wait for an element to appear on the page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 selector: {
    //                   type: 'string',
    //                   description: 'CSS selector to wait for'
    //                 },
    //                 timeout: {
    //                   type: 'number',
    //                   description: 'Timeout in milliseconds',
    //                   default: 30000
    //                 }
    //               },
    //               required: ['selector']
    //             }
    //           },
    //           {
    //             name: 'execute_script',
    //             description: 'Execute JavaScript in the browser',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {
    //                 script: {
    //                   type: 'string',
    //                   description: 'JavaScript code to execute'
    //                 }
    //               },
    //               required: ['script']
    //             }
    //           },
    //           {
    //             name: 'close_browser',
    //             description: 'Close the Firefox browser',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {}
    //             }
    //           },
    //           {
    //             name: 'get_current_url',
    //             description: 'Get the current page URL',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {}
    //             }
    //           },
    //           {
    //             name: 'back',
    //             description: 'Navigate back in browser history',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {}
    //             }
    //           },
    //           {
    //             name: 'forward',
    //             description: 'Navigate forward in browser history',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {}
    //             }
    //           },
    //           {
    //             name: 'reload',
    //             description: 'Reload the current page',
    //             inputSchema: {
    //               type: 'object',
    //               properties: {}
    //             }
    //           }
    //         ],
  • Helper method called by screenshot handler to ensure browser and page are initialized before taking screenshot.
    //   ensureBrowserRunning() {
    //     if (!this.browser || !this.page) {
    //       throw new Error('Firefox browser is not running. Please launch it first using the launch_firefox tool.');
    //     }
    //   }

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/JediLuke/firefox-mcp-server'

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