Snapshot active page
snapshotRetrieves a simplified DOM representation of the current page or a specified frame, giving a text preview or full text with metadata to inspect page structure and content.
Instructions
Return a simplified DOM snapshot for the current top document or an exact documentId from list_frames. Compact mode (default) returns textPreview only — not text. Full mode returns text. Compact defaults to main-landmark scope when present; a visible modal dialog (aria-modal=true or opened with showModal()) takes scope instead. Pass scope: "document" for legacy full-body text including the page behind a modal, ignoreRoles: ["dialog"] or ["alertdialog"] to hide both dialog and alertdialog, or mode: "full" for the unscoped legacy snapshot. Defaults truncate at 500 (compact) or 4000 (full) chars; pass textLimit (up to 100000) for long page content such as API docs. Response includes authoritative document identity and coordinate space.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Snapshot detail mode. Defaults to compact. Use full for text and verbose metadata, or visible for viewport-only refs, bounds, and labels. | |
| scope | No | Content root for text and elements. Compact defaults to main when a main landmark exists, or to a visible modal dialog (aria-modal=true or <dialog> opened with showModal()). Use document for the page behind a modal; pass ignoreRoles: ["dialog"] or ["alertdialog"] to hide both dialog and alertdialog. | |
| tabId | No | Optional Chrome tab id. Defaults to the claimed session tab, then the active tab. | |
| textLimit | No | Max body text characters. Optional; defaults to 500 (compact) or 4000 (full). Not a hard cap — maximum 100000. | |
| documentId | No | Exact frame document id returned by list_frames. Omit to target the current top document. | |
| ignoreRoles | No | Computed roles to exclude from scoped snapshots. Compact/main defaults to ["dialog"] when no visible dialog is open. A visible non-modal dialog is included without taking scope; a visible modal takes scope. Pass ["dialog"] or ["alertdialog"] to hide both roles, or [] to include them in the current scope. | |
| sessionTabId | No | Optional claimed tab session id returned by claim_tab. | |
| excludeSelectors | No | CSS selectors for subtrees removed from the scoped snapshot. |