browser_screenshot
Take a screenshot of the current page, a specific element by CSS selector or snapshot reference, or the full scrollable page. Supports PNG/JPEG, quality control, resizing, and returns file path or base64.
Instructions
Take a screenshot of the current page or a specific element. By default saves to file and returns the path (saves context window tokens). Use ref to screenshot a specific element (from snapshot refs like e1, e2), or element for a CSS selector. Omit both for a full page screenshot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetId | No | Target ID of the tab (from browser_tabs). If not provided, uses first available tab. | |
| ref | No | Element reference from snapshot (e.g., 'e1', 'e2') to screenshot a specific element. | |
| element | No | CSS selector to screenshot a specific element (alternative to ref). | |
| fullPage | No | Capture the full scrollable page instead of just the viewport (default: false). Not compatible with ref/element. | |
| type | No | Image format (default: png). Use jpeg for smaller file sizes. | |
| quality | No | JPEG quality (1-100). Only applies when type is 'jpeg'. Default: 80. Lower values = smaller file size. | |
| maxWidth | No | Maximum width in pixels. Image will be scaled down proportionally if wider. Reduces base64 size for large/full-page screenshots. | |
| returnAs | No | How to return the screenshot. 'file' (default) saves to disk and returns the file path — dramatically reduces context window usage. 'base64' returns inline image data (legacy behavior). | |
| savePath | No | Custom file path to save the screenshot to (only used when returnAs is 'file'). If not provided, saves to ~/.ultimate-playwright-mcp/screenshots/ with a timestamp filename. |