set_device
Switch browser device emulation between mobile and desktop modes. Recreates viewport, user agent, and touch settings while preserving cookies and localStorage.
Instructions
Switch browser device emulation between mobile and desktop modes. Recreates the browser context with new user agent and touch settings. Mobile presets emulate an exact viewport; desktop-class presets resize the real browser window (headed mode), so the page keeps following manual window resizes. 'desktop' imposes no size. Cookies and localStorage are preserved. Use preset device names for convenience or provide custom parameters. Returns page_state showing the page as rendered in the new device mode. Cannot be used while sub-agents are running.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | No | Device preset name: 'iphone_15', 'iphone_se', 'iphone_15_pro_max', 'pixel_7', 'galaxy_s24', 'ipad_pro', 'ipad', 'galaxy_tab_s9', 'desktop', 'desktop_hd'. Use 'desktop' to reset to default mode. Cannot be combined with custom fields. | |
| hasTouch | No | Enable touch event support. Cannot be used with 'device'. | |
| isMobile | No | Enable mobile viewport behavior. Cannot be used with 'device'. | |
| viewport | No | Custom viewport dimensions. Cannot be used with 'device'. | |
| userAgent | No | Custom user agent string. Cannot be used with 'device'. | |
| deviceScaleFactor | No | Device pixel ratio (e.g., 2 for retina, 3 for iPhone). Cannot be used with 'device'. |