Page Scanner

v0.4.5
io.github.sbd530/page-scanner Checked 4 days ago Published 1 month ago

Capture a web page from your own Chrome as a PDF whose text is still text.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

install Set up Page Scanner on this computer

Sets up Page Scanner's helper, which Chrome starts to connect the extension to this server, in every Chromium browser on this computer. Needs no port and no token, and returns no secret. Only needed once per machine. Afterwards the user opens the Page Scanner settings in Chrome, Local Agents, presses Connect and allows the prompt; tell them that, since you cannot do it for them.

ParameterTypeDescription
extensionIdsarrayMore extension ids to allow by hand. Leave out: the Chrome Web Store build and any unpacked copy of Page Scanner loaded in developer mode are allowed without it.

pair Pair this machine with Chrome

The older way to connect, for a machine where the install tool cannot set up the helper: writes the port and token the Page Scanner extension needs, and returns them so you can tell the user what to paste. Prefer install. The token is a secret that lets anything holding it scan any tab the user has open, and it will appear in this conversation, so do not repeat it anywhere else.

ParameterTypeDescription
rotatebooleanIssue a new token, invalidating the old one. Every browser must be re-paired.

list_browsers List connected browsers

The Chrome profiles that have Page Scanner paired and connected right now. Each is a separate browser: use its browserId to say which one you mean.

list_tabs List windows and tabs

The windows and open tabs of one browser, so you can pick what to scan. Tabs carry the windowId they belong to, and windows say which one is focused.

ParameterTypeDescription
browserIdstringWhich browser to act on, from list_browsers. Optional when only one is connected. Chrome runs a separate extension per profile, so a work profile and a personal profile are two different browsers.
waitSecondsnumberHow long to wait for a browser to connect, in seconds. Chrome retires the extension after about thirty seconds of silence, so the default covers the reconnect. 0 fails immediately.

scan_page Capture a page to a file

Captures a whole web page and writes it to disk. Name a tabId from list_tabs to capture a tab that is already open, a url to open one and capture that, or urls to capture a list of pages one after another. A PDF keeps real, selectable text; PNG and JPEG are images. Returns the absolute path it wrote, and a truncated report when the page was too large to capture whole; for urls, one result per page, each with its path or its error. Set markdown to get the page as text too, which is far easier to read than a PDF. A tall page or a long list can take minutes. When the answer has status "running",…

extract_design Read a page's design tokens

Reads a page's design as it is drawn: the colors, type, spacing, radii, shadows, motion and breakpoints its elements use, and the custom properties it declares, in both color schemes. Writes tokens.json (W3C design tokens), tokens.css, tailwind.preset.js, audit.md (values nearly equal), contrast.md (WCAG contrast of every text color over its background) and extract.json (the raw measurements) into outputPath, a directory. Give urls for several pages of one site, or crawl with a start address to have the pages found by following its links. A page that answered an HTTP error is not read in, and…

ParameterTypeDescription
browserIdstringWhich browser to act on, from list_browsers. Optional when only one is connected. Chrome runs a separate extension per profile, so a work profile and a personal profile are two different browsers.
componentsbooleanAlso find the components: repeated structures and controls, their variants and hover and focus states. Each page is scanned as well, and components.json, components.md and catalog.pdf (each variant cu…
crawlstringA start address to find the pages from, instead of naming them: its same-origin links are followed breadth first, one page per kind of page (so one blog post, not all), honoring robots.txt and nofollo…
depthintegerWith crawl: how many links away from the start address to go. Default 2.
maxPagesintegerWith crawl: how many pages to read at most. Default 10; each takes about 10 s.
minUsesintegerHow many uses make a value an inferred token. Default 2.
outputPathstringThe directory to write the files into. Defaults to design-<host> in the working directory, or in ~/Downloads where that cannot be written.
tabIdintegerA tab from list_tabs. Give one of tabId, url or urls.
timeoutSecondsnumberHow long the browser may take over one page, in seconds. Default 120. A very tall page, such as a long chat or feed, can take longer. Not how long this call waits: a capture that outlasts the call kee…
urlstringOpens a background tab on this address, reads it, and closes it again.
urlsarraySeveral pages of one site, read one after another and written as one design: the tokens and reports cover them all, and audit.md lists what only one page uses. A design system is spread over pages, so…
waitSecondsnumberHow long to wait for a browser to connect, in seconds. Chrome retires the extension after about thirty seconds of silence, so the default covers the reconnect. 0 fails immediately.

storyboard_page Scan a page's scroll as a storyboard

Scrolls a page from its top at a steady pace, 1.25 screens a second, and records how it behaves: where the screen holds while its content plays, what fades, slides, scales or is uncovered, and whether it glides on or plays once when the scroll stops. The scroll is cut into scenes. Writes a PDF (an overview and a page per scene with six frames from its entry to its exit), a .json beside it with every scene measured, and each scene's six frames as JPEGs in a .frames folder. Use it to rebuild a page's scroll animations, or to show them without a video. The result is that JSON, every frame with it…

ParameterTypeDescription
browserIdstringWhich browser to act on, from list_browsers. Optional when only one is connected. Chrome runs a separate extension per profile, so a work profile and a personal profile are two different browsers.
outputPathstringWhere to write the PDF. A directory keeps the suggested name, <title>-storyboard-<day>.pdf; the .json and the .frames folder go beside it, named after it. A leading ~ is the home directory. Defaults t…
tabIdintegerA tab from list_tabs, scrolled where the user can see it. Give one of tabId or url.
timeoutSecondsnumberHow long the browser may take, in seconds. Default 240: the scan scrolls for up to two minutes, then the PDF is built. Not how long this call waits (see the tool description).
urlstringOpens a background tab on this address, scans its scroll, and closes it again. Give one of tabId or url.
viewportobjectThe viewport to scan at, in CSS px. A tab opened for url is scanned at 1440 by 900 without it; a tabId at its window's size, and put back after one.
waitSecondsnumberHow long to wait for a browser to connect, in seconds. Chrome retires the extension after about thirty seconds of silence, so the default covers the reconnect. 0 fails immediately.
windowIdintegerWhich window to open `url` in, from list_tabs. Ignored when tabId is given.

diff_captures Say what changed between two captures

Compares two captures of the same page that scan_page wrote, with no browser needed. Two Markdown files are compared a passage at a time and the answer carries the changed lines and a unified diff; two PNGs are compared pixel by pixel and the newer one is written again with the changed regions outlined. For PDFs, scan with markdown "beside" and pass the PDFs or their .md files. "section" limits a text comparison to one section by its heading. "changed" says whether anything did.

ParameterTypeDescription
newPath *stringThe newer capture of the same page, of the same kind.
oldPath *stringThe older capture: a .md from markdown "beside" or "only", a PNG, or a PDF with its .md beside it.
outputPathstringFor two PNGs, where to write the newer one with the changed regions outlined. Defaults to beside it, as <name>.diff.png.
sectionstringFor Markdown, compare only the section under this heading, or under a path of headings ("Pricing > Pro"), so banners and rails around it do not count. A section only one capture has is a change; one n…

check_quotes Check quotes against a capture

Before quoting a page in an answer, checks that each quote or value occurs in the capture’s Markdown as written, with no browser and no model. The Markdown’s own markup (escapes, emphasis, link syntax, list and quote prefixes) is undone and line wrapping ignored; a quote never runs across two blocks, and a word or number has to stand apart (4.99 is not in 14.99). Each quote comes back with the line and the section it is under, or, when missing, where the capture parts from it, to correct it by. A match only once curly quotes, dashes and case are folded is reported as "loose" and does not c…

ParameterTypeDescription
quotes *arrayThe quotes and values to look for, each as it will appear in the answer: a sentence, a price, a date, a name.
loosebooleanAccept a quote that matches only once curly quotes, dashes, the ellipsis and case are folded. Off by default: a quote should be the page’s words.
markdownstringThe capture’s Markdown as text, as scan_page returns it with markdown "inline". Give this or path.
pathstringThe capture’s Markdown file: the .md scan_page wrote with markdown "beside" or "only". Give this or markdown.