microsoft / microsoft/playwright

[MCP]: Let a named screenshot be saved in the output directory

Open
#42,511 1 comment 0 reactions 0 assignees View on GitHub
P3-collecting-feedback
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

Follow-up to #42487.

### What I would like

I want to give a screenshot a name and still have it saved in the output directory.

Today those two things are exclusive. If I leave `filename` out, the file goes to the output directory but gets a timestamp name. If I give it a name, it goes to the working directory instead. There is no way to have both.

A setting in the Playwright MCP config that makes a named file go under `outputDir` would be enough. Off by default, so nothing changes for anyone who does not turn it on.

```json
{
"outputDir": ".playwright-mcp",
"resolveFilenamesInOutputDir": true
}
```

(The key name is a placeholder.)

### Why

I use the MCP from a coding agent. The working directory is the repository I am editing. The agent names its screenshots, so every screenshot lands at the root of the repository as an untracked file, and I have to clean up after it.

I have two workarounds today. I tell the agent to write `.playwright-mcp/shot.png`, but it does not follow that on every call. I also have a client-side hook that rewrites the name, but it only works in Claude Code; the same MCP used from another client has the same problem. I would rather the server decide where files go, once, in its own config.

### Version

`@playwright/mcp` 0.0.80

Contributor guide

Open the contributing guide

Research direction

Start at the Playwright MCP screenshot entry point and trace how filename and outputDir are currently resolved. Exercise the behavior described in the issue with @playwright/mcp 0.0.80, then add coverage for the opt-in configuration. Done means named screenshots remain in the working directory by default and are placed under outputDir when the setting is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.