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
emulate accepts empty, extra and unknown parts in geolocation and viewport and silently uses 0 or drops thememulate accepts empty, extra and unknown parts in geolocation and viewport and silently uses 0 or drops them #3097
After #2662, geolocationTransform and viewportTransform in src/tools/ToolDefinition.ts check that each number is finite and in range. They still convert each part with Number(...) and ignore anything they do not expect. Number("") and Number(" ") are 0, so an empty part is read as zero instead of being rejected:
"37.77," (trailing comma, longitude missing) emulates latitude 37.77, longitude 0.
"," emulates 0, 0 (Null Island).
"37.77,-122.42,9" drops the third part without a warning.
"0x10,0x20" is accepted as 16, 32, because Number parses hex literals.
viewport: "1280x720,mobile,bogus" ignores the unknown tag bogus, and "1280x720x2x9" ignores the fourth part.
In each case the call reports success and the page runs with a location or viewport other than the one requested, so the agent has no way to tell that its input was misread.
Possible Solution
Require exactly two parts for geolocation and two or three parts for the viewport dimensions, and reject empty parts.
Accept only plain decimal numbers (no hex, no blanks) by matching each part against a decimal pattern before converting it.
Reject viewport tags other than mobile, touch and landscape.
The emulate tool passes these results straight on to Emulation.setGeolocationOverride / setViewport.
Expectation
Inputs that do not match the documented formats (<latitude>,<longitude> and <width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]) are rejected at the input-validation layer with the existing clear error messages, as "999,999" and "abc" already are.
MCP configuration
Default (npx chrome-devtools-mcp@latest); no extra flags needed.
Chrome DevTools MCP version
1.10.1 (main at 830c693)
Chrome version
Not applicable (input parsing happens before any Chrome call).
Coding agent version
Not applicable.
Model version
Not applicable.
Chat log
Not applicable; the reproduction calls the transforms directly.
Activity
fix: reject empty, extra, and unknown parts in geolocation and viewpo…
fix: reject empty, extra, and unknown parts in geolocation and viewpo…
chore(main): release chrome-devtools-mcp 1.12.0 (#3168)
fix(config): reject --viewport values with more than two parts (Chrom…