Skip to main content
Glama

screenshot

Capture web page screenshots by providing a URL, with options for full-page capture and viewport dimensions.

Instructions

Captura screenshot de uma página web

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL da página para capturar
fullPageNoCapturar página inteira ou apenas viewport
widthNoLargura do viewport em pixels
heightNoAltura do viewport em pixels

Implementation Reference

  • Core handler function for the screenshot tool: launches headless Chromium via Playwright, navigates to the provided URL, captures a PNG screenshot (full page or viewport), encodes to base64, determines dimensions, and returns a structured result.
    export async function screenshot(
      params: ScreenshotParams
    ): Promise<ScreenshotResult> {
      const { url, fullPage = false, width = 1920, height = 1080 } = params;
    
      const browser = await chromium.launch({ headless: true });
      const page = await browser.newPage({
        userAgent:
          "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
      });
    
      try {
        await page.setViewportSize({ width, height });
        await page.goto(url, { waitUntil: "networkidle", timeout: 30000 });
        await page.waitForTimeout(1000);
    
        const screenshotBuffer = await page.screenshot({
          fullPage,
          type: "png",
        });
    
        const dimensions = await page.evaluate(() => ({
          width: document.documentElement.scrollWidth,
          height: document.documentElement.scrollHeight,
        }));
    
        return {
          url,
          base64: screenshotBuffer.toString("base64"),
          width: fullPage ? dimensions.width : width,
          height: fullPage ? dimensions.height : height,
          timestamp: new Date().toISOString(),
        };
      } finally {
        await browser.close();
      }
    }
  • TypeScript interfaces defining the input parameters (ScreenshotParams) and output structure (ScreenshotResult) for the screenshot tool.
    interface ScreenshotParams {
      url: string;
      fullPage?: boolean;
      width?: number;
      height?: number;
    }
    
    interface ScreenshotResult {
      url: string;
      base64: string;
      width: number;
      height: number;
      timestamp: string;
    }
  • Zod schema for input validation of the screenshot tool parameters, used in MCP server.tool registration.
    {
      url: z
        .string()
        .url()
        .describe("URL da página para capturar"),
      fullPage: z
        .boolean()
        .default(false)
        .describe("Capturar página inteira ou apenas viewport"),
      width: z
        .number()
        .int()
        .default(1920)
        .describe("Largura do viewport em pixels"),
      height: z
        .number()
        .int()
        .default(1080)
        .describe("Altura do viewport em pixels"),
    },
  • src/index.ts:112-147 (registration)
    MCP server registration of the 'screenshot' tool, including description, input schema, and wrapper handler that invokes the core screenshot function and returns MCP-formatted content (text description + base64 image).
    server.tool(
      "screenshot",
      "Captura screenshot de uma página web",
      {
        url: z
          .string()
          .url()
          .describe("URL da página para capturar"),
        fullPage: z
          .boolean()
          .default(false)
          .describe("Capturar página inteira ou apenas viewport"),
        width: z
          .number()
          .int()
          .default(1920)
          .describe("Largura do viewport em pixels"),
        height: z
          .number()
          .int()
          .default(1080)
          .describe("Altura do viewport em pixels"),
      },
      async (params) => {
        const result = await screenshot(params);
        return {
          content: [
            {
              type: "text",
              text: `Screenshot capturado: ${result.width}x${result.height}`,
            },
            { type: "image", data: result.base64, mimeType: "image/png" },
          ],
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('captura') but doesn't mention critical traits such as whether it requires network access, potential rate limits, error handling, or the format of the output (e.g., image data). This leaves significant gaps in understanding how the tool behaves in practice.

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 that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for a simple tool, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's complexity (a web screenshot tool with 4 parameters) and the absence of both annotations and an output schema, the description is incomplete. It doesn't address key contextual aspects like output format (e.g., image type), error conditions, or dependencies, leaving the agent with insufficient information for reliable use.

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 schema description coverage is 100%, with clear descriptions for all parameters (e.g., 'URL da página para capturar'). The description adds no additional semantic context beyond what the schema provides, such as explaining interactions between parameters. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 'Captura screenshot de uma página web' clearly states the tool's purpose with a specific verb ('captura') and resource ('screenshot de uma página web'), making it immediately understandable. However, it doesn't differentiate from sibling tools like 'fetchFullContent' or 'scrape', which might also involve web content retrieval, so it doesn't reach the highest score.

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 like 'fetchFullContent' or 'scrape'. It lacks explicit context, prerequisites, or exclusions, leaving the agent to infer usage based on the tool name alone, which is insufficient for optimal selection.

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/alucardeht/isis-mcp'

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