Skip to content

Printing the URL can burn lots of tokens #41531

Closed

Description

@linkej-autodesk

Many commands print the page URL whenever the page changed. For very long URLs, this can eat a considerable of the total agent context for little gain. E.g. an option to disable this would be appreciated.

For our application, we put many loading parameters into the URL, which can include e.g. a list of many dozens of files to load, or an 800char access token. This is very useful to e.g. give an agent a repro case just with a single URL.

One example I saw today (take this with a grain of salt, I don't know much about LLMs, maybe they have some deduplication magic)

If you decide to keep this, maybe it can be tuned to happen less often. E.g. it seemed like the first eval after a reload would also print the URL again, even if the eval didn't change anything substantial.

Thank you for this great tool!

Activity

  1. SeanLF commented on Mar 19, 2026

    @SeanLF

    Ran into the same class of problem -- verbose output eating agent context. After testing, most of the noise is already configurable via .playwright/cli.config.json:

    {
      "codegen": "none",
      "outputMode": "file",
      "console": { "level": "error" }
    }

    This kills the codegen blocks, moves snapshots to file links, and suppresses non-error console events. With this config, screenshot returns a single result line and click/goto return just ### Page + a snapshot file link.

    The one thing that isn't configurable is what this issue describes: the ### Page section (URL + title) is always emitted on navigation, with no way to suppress or truncate long URLs. For apps that encode tokens/parameters in the URL, this is the remaining gap.

    Would a pageUrl config option (e.g. "truncate" / "omit") be in scope, or would you prefer a more general approach?

  2. SeanLF commented on Mar 19, 2026

    @SeanLF

    Addendum: for anyone wanting these defaults globally without a per-project config file, PLAYWRIGHT_MCP_CONFIG env var works:

    export PLAYWRIGHT_MCP_CONFIG="$HOME/.playwright/cli.config.json"

    Tested on v0.1.1. Per-project .playwright/cli.config.json takes precedence when present.

  3. fondoger commented on Mar 20, 2026

    @fondoger

    I think playwright-cli can detect if it is executed in an interactive shell.

    If itself is running in an interactive shell, then it means it is called by users, so it can print more information.
    Otherwise, it is triggered by an agent, so it can show only necessary information.

  4. linkej-autodesk commented on Jun 29, 2026

    @linkej-autodesk
    Author

    The issue as reported is not fixed, we did include large configurations (and also access tokens in some cases) as URL parameters in regular URLs, not data: urls.

  5. pavelfeldman commented on Jun 29, 2026

    @pavelfeldman
    Member

    The issue as reported is not fixed, we did include large configurations (and also access tokens in some cases) as URL parameters in regular URLs, not data: urls.

    That is correct, but that is the extent we are willing to address this issue to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions