Skip to main content
Glama

responsive_screenshots

Capture screenshots at mobile, tablet, and desktop viewports to review responsive design.

Instructions

Capture screenshots at mobile (375px), tablet (768px), and desktop (1440px) viewports. Perfect for reviewing responsive design.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the page to capture

Implementation Reference

  • src/server.ts:462-506 (registration)
    Registration of the 'responsive_screenshots' MCP tool using server.tool(). Defines the Zod schema (url only) and the handler that calls captureResponsiveScreenshots(), then returns mobile/tablet/desktop images with the responsive review prompt.
    server.tool(
      "responsive_screenshots",
      "Capture screenshots at mobile (375px), tablet (768px), and desktop (1440px) viewports. Perfect for reviewing responsive design.",
      {
        url: z.string().url().describe("URL of the page to capture"),
      },
      async ({ url }) => {
        try {
          const results = await captureResponsiveScreenshots(url);
          const labels = ["Mobile (375px)", "Tablet (768px)", "Desktop (1440px)"];
    
          const content = results.flatMap((result, i) => [
            {
              type: "text" as const,
              text: `### ${labels[i]}`,
            },
            {
              type: "image" as const,
              data: result.base64,
              mimeType: result.mimeType,
            },
          ]);
    
          content.push({
            type: "text" as const,
            text: [
              ``,
              `---`,
              ``,
              `# Responsive Review Methodology`,
              ``,
              RESPONSIVE_REVIEW_PROMPT,
            ].join("\n"),
          });
    
          return { content };
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: "text" as const, text: `Responsive screenshots failed: ${message}` }],
            isError: true,
          };
        }
      }
    );
  • The core handler function 'captureResponsiveScreenshots' that captures screenshots at three viewports: mobile (375x812), tablet (768x1024), and desktop (1440x900). Iterates over the viewports and calls the existing captureScreenshot function for each.
    /**
     * Capture multiple viewport sizes for responsive review.
     */
    export async function captureResponsiveScreenshots(
      url: string
    ): Promise<readonly ScreenshotResult[]> {
      const viewports = [
        { width: 375, height: 812, label: "mobile" },
        { width: 768, height: 1024, label: "tablet" },
        { width: 1440, height: 900, label: "desktop" },
      ] as const;
    
      const results: ScreenshotResult[] = [];
    
      for (const viewport of viewports) {
        const result = await captureScreenshot({
          url,
          width: viewport.width,
          height: viewport.height,
          fullPage: true,
          delay: 1000,
          deviceScaleFactor: 2,
        });
        results.push(result);
      }
    
      return results;
    }
  • ScreenshotInput interface defining the input shape, reused by captureScreenshot which captureResponsiveScreenshots calls internally.
    export interface ScreenshotInput {
      readonly url: string;
      readonly width?: number;
      readonly height?: number;
      readonly fullPage?: boolean;
      readonly delay?: number;
      readonly deviceScaleFactor?: number;
    }
  • The captureScreenshot function that does the actual Puppeteer page creation, navigation, screenshot capture, and base64 encoding. Called by captureResponsiveScreenshots for each viewport.
    export async function captureScreenshot(
      input: ScreenshotInput
    ): Promise<ScreenshotResult> {
      const width = input.width ?? 1440;
      const height = input.height ?? 900;
      const fullPage = input.fullPage ?? true;
      const delay = input.delay ?? 1000;
      const deviceScaleFactor = input.deviceScaleFactor ?? 2;
    
      const page = await createPage(width, height, deviceScaleFactor);
    
      try {
        await navigateAndWait(page, input.url, delay);
    
        const screenshotBuffer = await page.screenshot({
          type: "png",
          fullPage,
          encoding: "binary",
        });
    
        const base64 = Buffer.from(screenshotBuffer).toString("base64");
    
        return {
          base64,
          mimeType: "image/png",
          width,
          height,
          url: input.url,
          timestamp: new Date().toISOString(),
        };
      } finally {
        await closePage(page);
      }
    }
    
    /**
     * Capture multiple viewport sizes for responsive review.
     */
    export async function captureResponsiveScreenshots(
      url: string
    ): Promise<readonly ScreenshotResult[]> {
      const viewports = [
        { width: 375, height: 812, label: "mobile" },
        { width: 768, height: 1024, label: "tablet" },
        { width: 1440, height: 900, label: "desktop" },
      ] as const;
    
      const results: ScreenshotResult[] = [];
    
      for (const viewport of viewports) {
        const result = await captureScreenshot({
          url,
          width: viewport.width,
          height: viewport.height,
          fullPage: true,
          delay: 1000,
          deviceScaleFactor: 2,
        });
        results.push(result);
      }
    
      return results;
    }
  • Registration of the 'responsive-review' prompt that is meant to be used after capturing responsive_screenshots. References RESPONSIVE_REVIEW_PROMPT which is also appended to the tool's output.
    server.prompt(
      "responsive-review",
      "Responsive design review methodology. Use after capturing responsive_screenshots to analyze layout across mobile, tablet, and desktop.",
      () => ({
        messages: [
          {
            role: "user" as const,
            content: {
              type: "text" as const,
              text: RESPONSIVE_REVIEW_PROMPT,
            },
          },
        ],
      })
    );
Behavior2/5

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

No annotations are provided, so the description bears full responsibility. It does not disclose behavioral traits such as error handling, return format (base64 or URLs), or whether screenshots are saved. The description only states the action without any side effects or limitations.

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 two sentences with no unnecessary words. The primary action is front-loaded, and the second sentence adds relevant context. Every part earns its place.

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?

With no output schema, the description should explain what the tool returns (e.g., an array of screenshot data). It fails to do so. However, the task is simple (single parameter, three viewports), so the gap is moderate. Adequate for minimal use but incomplete.

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?

Schema coverage is 100% for the single parameter 'url', which includes its own description. The tool description adds the context of capturing at three viewports but does not elaborate on the parameter's format or constraints beyond what the schema provides. Baseline 3 is appropriate.

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 'Capture screenshots at mobile (375px), tablet (768px), and desktop (1440px) viewports.' It uses a specific verb ('capture') and resource ('screenshots at specific viewports'), and distinguishes itself from sibling tools like 'screenshot' (single viewport) and 'compare_screenshots'.

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

Usage Guidelines4/5

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

The phrase 'Perfect for reviewing responsive design' indicates the primary use case. While it does not explicitly mention when not to use or name alternatives, the context is clear given the sibling tool list (e.g., 'screenshot' for single viewport).

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/prembobby39-gif/uimax-mcp'

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