Skip to main content
Glama

screenshot

Capture screenshots of web pages or specific elements for debugging and analysis. Save images to specified paths and capture full-page content including scrollable areas.

Instructions

Captura uma screenshot da página ou de um elemento específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullPageNoCapturar página inteira incluindo scroll
pathNoCaminho para salvar a screenshot (ex: './screenshot.png')
selectorNoSeletor CSS do elemento (opcional, captura página inteira se omitido)

Implementation Reference

  • Main handler function that captures screenshot of the current page or a specific element using Puppeteer Page.screenshot or ElementHandle.screenshot. Returns base64 encoded image and optional file path info.
    export async function handleScreenshot(args: unknown, currentPage: Page): Promise<ToolResponse> {
      const typedArgs = args as unknown as ScreenshotArgs;
      const { selector, fullPage = false, path } = typedArgs;
    
      const screenshotOptions: {
        fullPage: boolean;
        path?: string;
      } = { fullPage };
      if (path) screenshotOptions.path = path;
    
      let screenshot: Buffer | string;
      if (selector) {
        const element = await currentPage.$(selector);
        if (!element) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({ error: `Elemento não encontrado: ${selector}` }),
              },
            ],
          };
        }
        const result = await element.screenshot(screenshotOptions);
        screenshot = Buffer.from(result);
      } else {
        const result = await currentPage.screenshot(screenshotOptions);
        screenshot = Buffer.from(result);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              {
                success: true,
                message: path ? `Screenshot salva em: ${path}` : 'Screenshot capturada',
                base64: typeof screenshot === 'string' ? screenshot : screenshot.toString('base64'),
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • JSON schema definition for the screenshot tool input parameters, used for MCP tool listing and validation.
    {
      name: 'screenshot',
      description: 'Captura uma screenshot da página ou de um elemento específico',
      inputSchema: {
        type: 'object',
        properties: {
          selector: {
            type: 'string',
            description: 'Seletor CSS do elemento (opcional, captura página inteira se omitido)',
          },
          fullPage: {
            type: 'boolean',
            description: 'Capturar página inteira incluindo scroll',
            default: false,
          },
          path: {
            type: 'string',
            description: "Caminho para salvar a screenshot (ex: './screenshot.png')",
          },
        },
      },
    },
  • TypeScript interface defining the input arguments for the screenshot handler.
    export interface ScreenshotArgs {
      selector?: string;
      fullPage?: boolean;
      path?: string;
    }
  • src/index.ts:83-86 (registration)
    Dispatch registration in the MCP server request handler switch statement, which routes 'screenshot' tool calls to the handleScreenshot function.
    case 'screenshot': {
      const currentPage = await initBrowser();
      return await handleScreenshot(args, currentPage);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('captura') but doesn't explain key behaviors: for example, whether it saves the screenshot to a file (implied by 'path' parameter but not explicitly stated), if it requires specific permissions, or what happens on failure. This leaves gaps in understanding the tool's operation and potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Portuguese: 'Captura uma screenshot da página ou de um elemento específico.' It is front-loaded with the core action and resource, with no wasted words. Every part of the sentence contributes directly to understanding the tool's purpose, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage context, behavioral traits, or output handling. Without annotations or an output schema, more information on what the tool returns (e.g., file path confirmation or error messages) would improve completeness, but it's not entirely inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear explanations for each parameter (e.g., 'fullPage' for capturing the entire page with scroll, 'path' for saving location, 'selector' for CSS element). The description adds no additional semantic meaning beyond the schema, as it only mentions capturing a page or element without detailing parameters. This meets the baseline of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Captura uma screenshot da página ou de um elemento específico' (Captures a screenshot of the page or a specific element). It specifies the verb 'captura' and the resource 'página' or 'elemento específico', making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'get_page_info' or 'get_dom', which might also provide visual or structural information, so it doesn't reach a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, such as requiring a page to be loaded, or compare it to siblings like 'get_page_info' for textual data. Without such context, users might struggle to choose between this and other tools for capturing page information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/EmmanuelBarbosaMonteiro/mcp-server-browser'

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