Skip to main content
Glama

screenshot_compare

Capture web page screenshots at multiple viewport widths to compare responsive layouts across mobile, tablet, and desktop devices.

Instructions

Take screenshots at multiple viewport widths to compare responsive layouts. Returns file paths for mobile (375px), tablet (768px), and desktop (1440px) by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to screenshot
widthsNoViewport widths to capture (default: [375, 768, 1440])

Implementation Reference

  • The core implementation of the compareScreenshots function.
    async function compareScreenshots({ url, widths = [375, 768, 1440] }) {
      const results = [];
      for (const w of widths) {
        const label = w <= 480 ? "mobile" : w <= 1024 ? "tablet" : "desktop";
        const filepath = await takeScreenshot({
          url,
          width: w,
          height: w <= 480 ? 812 : w <= 1024 ? 1024 : 900,
          deviceScaleFactor: w <= 480 ? 3 : 2,
        });
        results.push({ label, width: w, path: filepath });
      }
      return results;
    }
  • src/index.js:246-267 (registration)
    The tool registration and schema definition for screenshot_compare.
    {
      name: "screenshot_compare",
      description:
        "Take screenshots at multiple viewport widths to compare responsive layouts. " +
        "Returns file paths for mobile (375px), tablet (768px), and desktop (1440px) by default.",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "URL to screenshot",
          },
          widths: {
            type: "array",
            items: { type: "number" },
            description: "Viewport widths to capture (default: [375, 768, 1440])",
            default: [375, 768, 1440],
          },
        },
        required: ["url"],
      },
    },
  • The request handler logic that invokes compareScreenshots and formats the output.
    case "screenshot_compare": {
      const results = await compareScreenshots(args);
      const content = [];
      for (const r of results) {
        const imageData = readFileSync(r.path);
        content.push({
          type: "image",
          data: imageData.toString("base64"),
          mimeType: "image/png",
        });
        content.push({
          type: "text",
          text: `${r.label} (${r.width}px): ${r.path}`,
        });
      }
      return { content };
    }
Behavior4/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 disclosure. It successfully explains the output format ('Returns file paths') and reveals the default behavioral configuration (specific pixel widths). It could improve by clarifying if this creates local files or temporary resources, but it covers the essential return contract missing from the output schema.

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 consists of exactly two sentences with zero waste: the first establishes the action and purpose, while the second covers return values and defaults. Every word earns its place and critical information is front-loaded.

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

Completeness4/5

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

Given the absence of both annotations and an output schema, the description adequately compensates by explaining what the tool returns ('file paths'). With 100% schema coverage for inputs, the description provides sufficient context for invocation, though it could briefly mention error handling or file persistence behavior.

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

Parameters4/5

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

While the schema has 100% coverage (baseline 3), the description adds valuable semantic meaning by categorizing the default widths as 'mobile (375px), tablet (768px), and desktop (1440px)', which helps the agent understand the intent behind the raw numeric defaults.

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

Purpose5/5

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

The description clearly states the specific action ('Take screenshots'), the unique approach ('at multiple viewport widths'), and the goal ('to compare responsive layouts'). This effectively distinguishes it from the sibling 'screenshot' tool which likely captures a single viewport.

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

Usage Guidelines3/5

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

The description implies the use case ('to compare responsive layouts') but does not explicitly state when to use this tool versus the sibling 'screenshot' tool, nor does it provide explicit when-not-to-use guidance or prerequisites.

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/kjaiswal/browsershot-mcp'

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