Skip to content

Feature Request: Add Save to File for take_snapshot and evaluate_script tools #153

Description

@brian-ln

Is your feature request related to a problem? Please describe.
I am unable to save off screenshots using the chrome-devtools-mcp server. Sometimes I also get too many token errors on tool results.

Describe the solution you'd like
Add a save to file optional parameter to tools that return images (take_screenshot) or large amounts of data (take_snapshot, evaluate_script) .

The mcp-chrome server (and several others) supports saving images as files using the asPng optional parameter.

From the mcp-chrome server:

{
    name: TOOL_NAMES.BROWSER.SCREENSHOT,
    description:
      'Take a screenshot of the current page or a specific element(if you want to see the page, recommend to use chrome_get_web_content first)',
    inputSchema: {
      type: 'object',
      properties: {
        name: { type: 'string', description: 'Name for the screenshot, if saving as PNG' },
        selector: { type: 'string', description: 'CSS selector for element to screenshot' },
        width: { type: 'number', description: 'Width in pixels (default: 800)' },
        height: { type: 'number', description: 'Height in pixels (default: 600)' },
        storeBase64: {
          type: 'boolean',
          description:
            'return screenshot in base64 format (default: false) if you want to see the page, recommend set this to be true',
        },
        fullPage: {
          type: 'boolean',
          description: 'Store screenshot of the entire page (default: true)',
        },
        savePng: {
          type: 'boolean',
          description:
            'Save screenshot as PNG file (default: true),if you want to see the page, recommend set this to be false, and set storeBase64 to be true',
        },
      },
      required: [],
    },
  },

Describe alternatives you've considered
Claude code can't (or won't) let me save the [Image] data returned from the tool call to take_screenshot...

Additional context
The mcp-chrome server (and others) also support returning images as base 64 content using the storeBase64 optional parameter.

Activity

  1. changed the title [-]Add save to file to screenshot and other tools[/-] [+]Feature Request: Add Save to File for Screenshot and Other Tool Calls[/+] on Sep 25, 2025
  2. OrKoN commented on Sep 26, 2025

    @OrKoN
    Collaborator

    I think it makes sense to have this. What we currently do:

    1. if the image is less than 2 MB we return it as an image content according to the MCP.
    2. if it is larger than 2 MB, we save it to a tmp file (automatically generated filename).

    Note that the feature request is also about saving script output to file so it only partially overlaps with #152.

  3. natorion commented on Sep 26, 2025

    @natorion
    Contributor

    There is still the open question if its not the MCP client's job to handle such interactions properly.

  4. added 2 commits that reference this issue on Sep 26, 2025
    386b2ae
    22c8589
  5. added 3 commits that reference this issue on Sep 29, 2025
    a5d4f0c
    eb6aed9
    1847d3f
  6. reopened this on Sep 30, 2025
  7. OrKoN commented on Sep 30, 2025

    @OrKoN
    Collaborator

    The part about saving screenshots to file was merged but saving script output to file is still to do.

  8. changed the title [-]Feature Request: Add Save to File for Screenshot and Other Tool Calls[/-] [+]Feature Request: Add Save to File for take_snapshot and evaluate_script tools[/+] on Sep 30, 2025
  9. added a commit that references this issue on Sep 30, 2025
    f030726
  10. 1 remaining item

  11. OrKoN commented on Oct 1, 2025

    @OrKoN
    Collaborator

    Should we also consider adding the JS file path as an input parameter for evaluate_script? I've found that instead of having the large model temporarily write a lot of repetitive code, it's better to fix the JS file locally and let it be directly read and transferred. This can reduce token consumption.

    Could you please file a separate feature request for this? and perhaps explain in more details what kind of scripts does your use case require?

  12. Coquinate commented on Oct 1, 2025

    @Coquinate
    Contributor

    I'll take a look at implementing this. Seems straightforward since screenshot already has the filePath pattern.

  13. added a commit that references this issue on Oct 1, 2025
    7fc55a6
  14. sebastianbenz commented on Oct 2, 2025

    @sebastianbenz
    Collaborator

    @Coquinate as suggested by @OrKoN, please create a separate issue first and list a few use cases for this first before working on this.

  15. Coquinate commented on Oct 2, 2025

    @Coquinate
    Contributor

    @sebastianbenz I believe there may be some confusion - I've worked on the original issue #153 (adding filePath parameter to save evaluate_script and take_snapshot output to file), not the separate suggestion from @xubaifuCode about JS file input.

    Issue #153 already documents the use cases:

    • Reducing token consumption when dealing with large script outputs or snapshots
    • Handling data that exceeds MCP size limits

    I've already submitted PR #248 with the implementation following the same pattern as take_screenshot's filePath parameter. Happy to discuss the approach or add more context if needed.

  16. added a commit that references this issue on Oct 10, 2025
    777333e
  17. johnisking commented on Oct 23, 2026

    @johnisking

    Adding a data point for the "too many tokens" part of this request.

    A single take_snapshot of a long page (the Python article on English Wikipedia, Chrome DevTools MCP 1.11.0, 2026-10-22) was 427,400 characters, about 208,926 Claude tokens. Claude Code already refuses results that large and writes them to a file itself, so the task still finished there. Other clients would send the whole snapshot to the model, at about $1.65 per call on Opus 5.5.

    A filePath option (as in #248) would make that behavior available in every client.

    Data and method (94 runs, CC BY 4.0): https://doi.org/10.5281/zenodo.23555401

    Disclosure: I run TokenSave, which published this measurement.

  18. OrKoN commented on Oct 23, 2026

    @OrKoN
    Collaborator

    file path params already exist on both commands #463 and #2054

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions