You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
resize_page reports an out-of-date page size when the target page is a background tab #3306
resize_page resizes the browser window correctly. But when the target page
is not the front tab, the tool adds a wrong line to the response:
Requested 1100x750, page is 1504x836
The window and the front tab are 1100x750. The target tab shows 1100x750 only
after it comes to the front.
Cause: since #3132, McpPage.resize() reads Page.getLayoutMetrics from the
target page right after the resize
(src/McpPage.ts#L1442-L1479).
Chrome does not lay out a background tab again until the tab is visible. Thus
the metrics show the old size. With page ID routing (default true), a page
tool does not bring its page to the front.
An agent that reads this line can think that the resize failed, and can try
again or take a wrong action. Before #3132, the tool did not print a size.
Reproduction
new_page with {"url": "http://localhost:8787/"}. This is page 2.
new_page with {"url": "https://developer.chrome.com/docs/devtools"}.
This is page 3. Page 3 is now the front tab.
resize_page with {"pageId": 2, "width": 1100, "height": 750}.
Result: Requested 1100x750, page is 1504x836.
evaluate_script on page 3 with () => [innerWidth, innerHeight].
Result: [1100, 750].
evaluate_script on page 2 with the same function. Result: [1504, 836].
select_page with {"pageId": 2, "bringToFront": true}.
evaluate_script on page 2 again. Result: [1100, 750].
When the target page is the front tab, the tool prints no mismatch line.
Expectation
The tool does not print a mismatch line when the window was resized
correctly. Possible fixes:
Bring the target page to the front before the resize.
Or skip the size check (or say that the size is unknown) when the target
page is not the front tab.
Activity
fix(pages): revert reporting the page size after resize_page (ChromeD…
chore(main): release chrome-devtools-mcp 1.12.0 (#3168)