Description of the bug
The emulate tool documents strict formats and bounds for viewport and geolocation, but the zod transforms do not validate them. Malformed input passes the tool's input-validation layer and only fails later at a lower level, with cryptic errors that do not point at the actual cause.
Reproduction
Start the server, open a page, then call emulate with invalid input:
emulate with {"viewport": "abc"} → Error: Protocol error (Emulation.setDeviceMetricsOverride): Invalid parameters Failed to deserialize params.width
emulate with {"geolocation": "999,999"} → Error: Invalid longitude "999": precondition -180 <= LONGITUDE <= 180 failed.
Expectation
Expected behavior
Invalid viewport / geolocation values should be rejected at the tool's input-validation layer with a clear, actionable message (consistent with other zod Input validation error responses), before any CDP call is made.
Actual behavior
Invalid values are silently parsed into NaN / out-of-range numbers and only fail later as low-level Puppeteer/CDP errors that give no hint that the input string was malformed.
MCP configuration
No response
Chrome DevTools MCP version
1.8.0
Chrome version
152
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist
Description of the bug
The
emulatetool documents strict formats and bounds forviewportandgeolocation, but the zod transforms do not validate them. Malformed input passes the tool's input-validation layer and only fails later at a lower level, with cryptic errors that do not point at the actual cause.Reproduction
Start the server, open a page, then call
emulatewith invalid input:emulatewith{"viewport": "abc"}→Error: Protocol error (Emulation.setDeviceMetricsOverride): Invalid parameters Failed to deserialize params.widthemulatewith{"geolocation": "999,999"}→Error: Invalid longitude "999": precondition -180 <= LONGITUDE <= 180 failed.Expectation
Expected behavior
Invalid
viewport/geolocationvalues should be rejected at the tool's input-validation layer with a clear, actionable message (consistent with other zodInput validation errorresponses), before any CDP call is made.Actual behavior
Invalid values are silently parsed into
NaN/ out-of-range numbers and only fail later as low-level Puppeteer/CDP errors that give no hint that the input string was malformed.MCP configuration
No response
Chrome DevTools MCP version
1.8.0
Chrome version
152
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
None
Extra checklist