# v0.2.0 — Max Access: Query, Scroll, Script, Record

## TL;DR

Five new tools that let an agent reconstruct and watch a page faithfully — not just snapshot it. Query the DOM with CSS selectors (raw SVG / `foreignObject`, not the collapsed `take_snapshot` view), scroll precisely, run arbitrary JavaScript behind a flag, and record short screen sequences as PNG frames plus an animated GIF.

## Why

`take_snapshot` flattens the interesting parts — an SVG's `tspan` runs, `foreignObject` nodes, computed layout. An agent verifying a rendered mermaid diagram or a canvas overlay sees mush. And a single screenshot can't show motion: a transition, a scroll reveal, a spinner mid-spin. v0.2.0 closes both gaps while staying token-frugal — you pull exactly the DOM slice you need, and motion comes back as frames you can read one at a time.

## Highlights

| Tool | What it does |
|------|--------------|
| `query_dom` | CSS-selector DOM query, 9 modes (outline / text / html / outer / attr / styles / table / count / json). Returns the raw nodes `take_snapshot` collapses. |
| `scroll_page` | Viewport / element scroll (top / bottom / by / element) with scroll metrics + a screenshot. Registered as a mutation tool. |
| `evaluate_script` | Arbitrary JavaScript in the page context. Gated behind `--enable-script`. |
| `start_recording` / `stop_recording` | Screenshot-poll capture → PNG frames + animated GIF on disk, evenly-sampled frames returned inline. Suppresses per-call screenshots while recording. |

## How It Works

**Recording** polls a full-page screenshot on an interval (default 2 fps, capped at 4) and buffers each frame with a timestamp, auto-stopping at 120 frames or a duration cap. `stop_recording` writes every frame as `frame-NNN.png` plus a `recording.gif` (encoded with gifenc) and returns a handful of evenly-spaced frames inline. The GIF is the human artifact; the PNG frames are the agent artifact — a model reading an animated GIF sees only frame 0.

While a recording is active, the auto-screenshot middleware is suppressed via an `isRecording()` guard, so per-call screenshots don't perturb the capture cadence.

**query_dom** injects a small browser-side script that walks the DOM for a selector and serializes only the requested projection, keeping responses small.

## Config

- `--enable-script` — new CLI flag that enables `evaluate_script`. Off by default (it permits arbitrary JavaScript execution in the page).
- New runtime dependencies: `gifenc` and `pngjs` — both pure-JS, zero native bindings. Loaded via `createRequire` so the ESM bundle can consume these CommonJS modules.
- Recordings land in `~/.firefox-devtools-mcp/recordings/<timestamp>/`.

## Files Changed

- `src/tools/query-dom.ts`, `src/tools/scroll.ts`, `src/tools/recording.ts` — the new tools
- `src/types/gifenc.d.ts` — ambient types for gifenc (ships none)
- `src/tools/index.ts`, `src/index.ts` — registration, `MUTATION_TOOLS += scroll_page`, and the auto-screenshot suppression guard
- `package.json` — `gifenc`, `pngjs`, `@types/pngjs`; version → 0.2.0
