Skip to content

resize_page reports success when the page does not end up at the requested size #2998

Closed

Description

@coygeek

Description of the bug

resize_page is described as resizing "the page's window so that the page has specified dimension". When Chrome clamps the request, for example to its minimum window width, the tool still returns a normal success response and does not mention the page's resulting size. An agent that resizes to test a breakpoint then inspects a page that is wider than it believes.

Actual behavior

Both builds:

resize_page 800x600  -> success (page list only);  SIZE -> [800,600]
resize_page 100x100  -> success (page list only);  SIZE -> [500,100]

The 100x100 response is identical to the successful 800x600 response.

Reproduction

  1. Serve any HTML page from a loopback HTTP server at http://127.0.0.1:PORT/min.html (for example <!doctype html><title>min</title><h1>Hello</h1>).

  2. Start the server under test with the flags above and send these tools/call requests in order (SIZE stands for () => [innerWidth, innerHeight]):

{"name":"new_page","arguments":{"url":"http://127.0.0.1:PORT/min.html"}}
{"name":"resize_page","arguments":{"pageId":2,"width":800,"height":600}}
{"name":"evaluate_script","arguments":{"pageId":2,"function":"SIZE"}}
{"name":"resize_page","arguments":{"pageId":2,"width":100,"height":100}}
{"name":"evaluate_script","arguments":{"pageId":2,"function":"SIZE"}}

The sequence was run once per build with identical results, and again within a longer sequence per build; an earlier independent run on both builds in headless mode, and on the release build in headful (isolated) mode, gave the same kind of result (headful: 100x100 gave 500x232, 20000x20000 gave 20000x1147, both with a success response).

Expectation

resize_page (src/tools/pages.ts:318-357, main build; docs/tool-reference.md, resize_page) promises a page with the specified dimensions. When Chrome cannot produce that size, the response says so, for example by reporting the resulting page size or returning an error, instead of an unqualified success.

MCP configuration

--headless --isolated --no-usage-statistics --no-performance-crux unless the reproduction states otherwise (update checks disabled with CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1).

Chrome DevTools MCP version

1.10.1 (npm) and main 5ddb0a3 (local build)

Chrome version

154.0.8037.98 (stable)

Node version

v22.23.2

Operating system

macOS 27.0

Environment details

  • chrome-devtools-mcp 1.10.1 from npm (the release build).
  • chrome-devtools-mcp built from main at commit 5ddb0a3 (the main build).
  • Google Chrome 154.0.8037.98 stable, headless; Node v22.23.2; macOS 27.
  • Both builds were started with --headless --isolated --no-usage-statistics --no-performance-crux and CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1, and driven by a scripted stdio MCP client.

Evidence

  • Expected source: resize_page description "Resizes the page's window so that the page has specified dimension" in src/tools/pages.ts:320 (main build) and docs/tool-reference.md.
  • Failure source: scripted MCP runs above on both builds. The handler calls page.pptrPage.resize({contentWidth, contentHeight}) and then only response.setIncludePages(true) (src/tools/pages.ts:350-355, main build), without reading back the resulting size.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Fix check

With the steps above, the resize_page 100x100 response either reports that the page is 500x100 (or otherwise differs from the request) or is an error. As a control, resize_page 800x600 still returns success for a page that ends up 800x600.

Additional context

The full open and closed issue and PR corpus was screened as of 2026-10-06. Open PR #2784 ("fix: reject non-positive resize_page dimensions") validates 0, negative and non-finite sizes; it does not cover sizes that Chrome accepts but clamps. A related input gap not covered by PR #2784 either: fractional sizes such as 640.5x480.2 return the raw error Protocol error (Browser.setContentsSize): Invalid parameters Failed to deserialize params.width - BINDINGS: int32 value expected on both builds; that is an input-validation question and may fit PR #2784's scope better than this issue. Separately, with an active emulate viewport of 500x400, resize_page 900x700 succeeded and the page stayed 500x400; that response does list the active Emulating viewport line, and the emulation taking precedence may be intended, so it is not part of this report.

Activity

  1. added theissue type on Oct 12, 2026
  2. reopened this on Oct 22, 2026
  3. OrKoN commented on Nov 10, 2026

    @OrKoN
    Collaborator

    Using layout metrics does not work for backgrounded pages. Please do not send PRs doing that. #3132 was reverted after discovering this.

  4. iyuzhang commented on Nov 18, 2026

    @iyuzhang
    Contributor

    Could we mention in the resize_page tool description that Chrome may clamp the requested dimensions even when the call succeeds?

  5. added a commit that references this issue on Nov 23, 2026
    b5a41e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions