pxtree
v0.1.2Measures how a webpage actually renders and prints it as compact text for AI coding agents.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
measure
Measures how a webpage renders in headless Chromium and returns compact text: a facts line, changes since the last run, a findings summary, then an indented tree, one line per element. Findings are measurements that passed a threshold, never verdicts. Parameters: target (URL, host or HTML file path), viewports, schemes, scroll, element, children, colors, wait, script (Playwright page code), screenshot, timeout, diff, diffKey, report (tree, findings, summary, changes or none), aria (names, roles, states). One call returns the report, aria tree and screenshot for every viewport, scheme and scro…
| Parameter | Type | Description |
|---|---|---|
target * | string | A string: URL, host like localhost:5173, or HTML file path under the working directory |
aria | boolean | A boolean: add Playwright's aria snapshot of the page, or of each element match, after the report |
children | boolean | A boolean. With element: include what is inside the matches. Default true |
colors | boolean | A boolean: print hex colors in [text] and [renders] |
diff | boolean | A boolean: compare with the previous run of the same target and settings. Default true |
diffKey | string | A name string that replaces script and wait in the since-last-run key, to compare a scripted run with a plain run that used the same name |
element | string | A CSS selector string: print only matching elements and their ancestor lines |
maxChars | number | A number: the longest report in characters. Past it the tree is cut at a line; facts, since last run and summary stay. Default 80000 |
report | string | One of "tree", "findings", "summary", "changes", "none". tree: everything. findings: only lines with findings and their ancestors. summary: no tree. changes: facts line and since last run. none: facts… |
schemes | array | An array of "light" and "dark", the prefers-color-scheme per run. Default ["light"] |
screenshot | boolean | A boolean: save a PNG per run under the OS temp directory and return its path |
script | string | A string: the body of async (page) => {}, or a whole function like async (page) => {}, run with the Playwright page before measuring. It is trusted code that runs as Node in the server process with it… |
scroll | A stop or an array of stops: a number or digit string is a window y offset, "end" is the bottom, anything else is a CSS selector to scroll to the top. An array measures each stop in turn, one run per… | |
timeout | number | A number of milliseconds to reach DOMContentLoaded. The script, a wait, reveal, settle and measuring each get this long again. Default 30000 |
viewports | array | An array of { width, height } with integer numbers, one run each. Default [{ width: 1280, height: 800 }] |
wait | After the script: a number or digit string of milliseconds to sleep, at most timeout, or a CSS selector string to wait up to timeout for |
read_me_first
Read once per session before the first measure. How to use pxtree and how to read its output.