Why does Playwright MCP use 6x more tokens since v0.0.32 and how can I reduce output?
Since upgrading Playwright MCP from 0.0.30 to 0.0.32, the same browser automation task consumes about 6x more tokens in Claude Desktop and VS Code Copilot with Claude 3.5, even with no vision enabled. Some tasks hit the context limit after only a few tool calls, and browser_evaluate responses include a large page state. Is there a configuration option, CLI flag, or environment variable to limit the verbosity or size of tool responses?
Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/889
5 answers
Status: explained, with no fix implemented. As of this thread, Playwright MCP has no built-in option to limit the size or verbosity of tool responses, and a maintainer stated they do not plan to add one.
A Playwright team member confirmed that console messages started being logged between v0.0.30 and v0.0.32, which is the likely cause of the token increase. The messages are trimmed, but pages with many console errors can still consume a lot of tokens. One user also reported that browser_evaluate returns the full page state along with the evaluation result, which can fill the context window after just a few calls.
The maintainer explained that the project deliberately keeps the tool simple: it returns the full snapshot and lets the LLM summarize it, and they are not prioritizing context-window or cost limits. Two workarounds were suggested in the thread: use subagents where possible, since each subagent has its own context loop and can run longer scenarios without filling the main thread; and choose an agentic loop that handles conversation summarization well. General advice for the browser_evaluate scraping scenario: keep the iterate-and-evaluate loop inside a subagent so the large page state is summarized before it returns to the main conversation.
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The reporter compared the same task on Playwright MCP 0.0.30 and 0.0.32, measured roughly 6x more tokens with no vision enabled, could not find the reason, and proposed a low/medium/high verbosity configuration parameter.
Source: https://github.com/microsoft/playwright-mcp/issues/889 (opens external site)
Did this work for you?What @zeehjr tried on GitHub (Outcome unclear)
A commenter looked at recent releases and found that tool output now includes page console/log messages. They suggested snapshots after tool calls would be enough for most tasks and that logs could be stored in files instead.
Source: https://github.com/microsoft/playwright-mcp/issues/889#issuecomment-3189893194 (opens external site)
Did this work for you?What @jjcampana tried on GitHub (Outcome unclear)
A commenter tested different web apps and found token consumption depended heavily on the page, with pages showing many console errors burning far more tokens, supporting the console-logging explanation.
Source: https://github.com/microsoft/playwright-mcp/issues/889#issuecomment-3199279105 (opens external site)
Did this work for you?What @jjkavalam tried on GitHub (Outcome unclear)
A VS Code GitHub Copilot user iterating on JavaScript with browser_evaluate found that each call returned not only the result but also the full page state, quickly filling the context window. They requested a parameter to disable page state in the response.
Source: https://github.com/microsoft/playwright-mcp/issues/889#issuecomment-3338905799 (opens external site)
Did this work for you?
Related questions
- Playwright MCP browser_take_screenshot shows no saved file or unreadable image in Cursor or VS Code
- Windows: playwright-mcp via Claude Desktop fails: Chromium distribution 'chrome' is not found
- playwright-mcp fails to start in Cursor after 0.0.19/0.0.20 (Client closed / Connection closed)
- Can I generate codegen-style Playwright test code from a prompt-driven playwright-mcp flow?
- Does Playwright MCP have a quiet mode to reduce page snapshot tokens?