preview_snapshot has no scoping option and costs ~17k tokens plus a PNG per call #9200
nitrimandylis
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
preview_snapshotreturns page state, semantic elements, diagnostics, action history and a PNG screenshot on every call, and its only parameter istabId. There is no way to ask for less.On a plan-limited Claude subscription that is expensive, and the cost is not obvious from the tool description.
Measurements
I parsed my local Claude Code transcripts (
~/.claude/projects/**/*.jsonl) and measured the text length of every tool result, grouped by tool. Text blocks only, so the PNG is on top of every number below.mcp__t3-code__preview_snapshotplaywright/browser_snapshotReadBashAbout 9.5x the equivalent Playwright snapshot and 57x a shell result.
The larger effect is that a tool result stays in the conversation and is re-sent on every subsequent request in that thread. Weighting tokens the way billing does (cache read x1, cache write x2, output x5), deduplicating by
requestId, and attributing eachpreview_*result to every later request in the same session:Session A spent over a quarter of its entire token budget re-reading snapshots.
As an independent check, Claude Code's own
/usagebreakdown attributed 16% of my last 24 hours to thet3-codeMCP server, against 4% forplaywrightover the same window.What would fix it
Any one of these, roughly in order of usefulness to me:
preview_snapshotis currently the only way to get a PNG, so "let me look at the page" forces the full text dump along with it. Most of the time the image alone answers the question.preview_snapshot, e.g.include: ["semantics"]/["screenshot"]/["diagnostics"], or a CSS/role selector to snapshot a subtree rather than the document.action historyfrom the default payload. It grows monotonically within a tab, so repeated snapshots in one thread each carry a longer copy of the same log.Happy to share the parsing script if the numbers are useful to reproduce.
All reactions