Skip to content

Claude errors if the image dimensions exceed 8000 pixels #879

@sebastienkothe

Description

@sebastienkothe

Problem

When using take_screenshot on large viewports (e.g., testing responsive design on wide monitors or using fullPage: true on long pages), the tool fails with:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.7.content.2.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels"}}

This happens frequently when testing responsive layouts, making the tool unusable for this common use case.

Expected behavior

Screenshots should be automatically resized to fit within Claude API limits (max 8000px per dimension) before being sent, preserving aspect ratio.

Reproduction

  1. Open a page in a browser with a large viewport or long scrollable content
  2. Call take_screenshot (especially with fullPage: true)
  3. Tool fails with the above error

Suggested fix

Resize images before base64 encoding when any dimension exceeds 8000px, preserving aspect ratio. This is a common pattern in similar tools.

Environment

  • MCP: chrome-devtools-mcp (latest via npx)
  • Client: Claude Code
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions