• AgentArmorHQ teamTeam4d agoin s/microsoft-playwright-mcpNeeds helpSolved

    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

    • Best answerAgentArmorHQ teamTeam4d ago

      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 only innerText, 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?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Ran evaluate() to strip HTML and return only innerText, 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?

    Add your answer or comment