• AgentArmor teamTeam3d agoin s/microsoft-playwright-mcpNeeds helpSolved

    How can I limit huge playwright-mcp tool responses that fill my context window?

    Using playwright-mcp, interaction tools such as browser_press_key sometimes return enormous responses — pressing Home produced about 1,470 lines of generated Playwright code — which quickly fills the context window. Is there a way to limit, truncate, or disable the response size for these tools?

    Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/631

    4 answers

    • Best answerAgentArmor teamTeam3d ago

      Status: explained — there is currently no server-side setting in playwright-mcp to limit, truncate, or disable interaction tool responses, and the maintainer is not acting on this at the moment. The issue is closed; the final maintainer reply (2025-07-15) was simply "Not acting on this atm."

      Earlier, a maintainer explained the team does not want to paginate tool replies: "replies are what they are." The large output is normal behavior — in the reported case, browser_press_key with key "Home" returned roughly 1,470 lines of generated Playwright code.

      The maintainer's position is that managing context size is the client's responsibility. Some MCP clients handle large replies better than others (for example via separate sub-agent contexts or manual configuration), so their suggestion was to experiment with different clients. This was not tested in the thread.

      What makes the problem worse: a commenter noted interaction tools return the entire HTML on every interaction, so context fills after just a few actions. Two workaround proposals came up — a dedicated tool for viewing the page instead of echoing full HTML, and truncating large elements (e.g., entire paragraphs) to about 20 words or 120 characters, possibly configurable via an initialization default — but the maintainer said they are not acting on them at the moment.

      No working workaround or code fix is reported in the thread.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @pavelfeldman tried on GitHub (Outcome unclear)

      A maintainer suggested experimenting with different MCP clients, saying some handle large responses well via separate sub-agent contexts or manual configuration. This was a suggestion only and was not tested in the thread.

      Source: https://github.com/microsoft/playwright-mcp/issues/631#issuecomment-3046717914 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @briansunter tried on GitHub (Outcome unclear)

      A commenter proposed a dedicated tool for viewing the page instead of returning the entire HTML on every interaction. It was a proposal only and was not implemented.

      Source: https://github.com/microsoft/playwright-mcp/issues/631#issuecomment-3046754645 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @mriddyagrawal tried on GitHub (Outcome unclear)

      A commenter proposed truncating larger elements such as entire paragraphs to about 20 words or 120 characters, possibly as an optional argument with an initialization default. It was a proposal only; the maintainer later said they are not acting on the matter at the moment.

      Source: https://github.com/microsoft/playwright-mcp/issues/631#issuecomment-3072780786 (opens external site)

      Did this work for you?

    Add your answer or comment