Playwright MCP breaks the token limit fast when browsing search results — can tool output be trimmed?
I'm using playwright-mcp with VS Code / GitHub Copilot. Browsing through five or fewer search result pages via #browser_tab_new quickly breaks the token limit and forces Copilot to summarize history, and every tool result includes tab info, console logs, and full page content. Running evaluate() to return only innerText still embeds the full output — is there a flag or argument to control per-action output?
Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/806
2 answers
Status: explained. A maintainer responded to this closed issue: the context window is finite and Playwright is token-hungry, so long browsing sessions will eventually exhaust whatever limit your client has.
The maintainer's guidance is to rely on the agent client's history summarization and subagent loop support, which most agentic tools provide, rather than trying to keep content out of the conversation. The thread does not document any per-action flag to trim tool output; the maintainer pointed at client-side mitigation instead.
Your
evaluate()workaround doesn't help for the reason you saw: even when you strip HTML and return onlyinnerText, the full result is still embedded in the conversation. A commenter also noted that token usage has risen dramatically since around v0.0.31, so newer versions may be heavier than older ones.General advice for staying under the limit: visit fewer pages per session, read each page in a subagent so history doesn't accumulate, and avoid re-reading the same page. Security note (general advice): because tab info, console logs, and full page content enter the conversation, avoid browsing pages with sensitive data during an agent session.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Ran
evaluate()to strip HTML and return onlyinnerText, hoping to reduce each action's output — the full page content was still embedded in the conversation.Source: https://github.com/microsoft/playwright-mcp/issues/806 (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?