[MCP]: Add optional atomic upload action for file chooser triggers
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- playwright, typescript
- Área
- testing-qa, tooling
Línea de trabajo
Start with packages/playwright-core/src/tools/backend/files.ts and tool.ts, then read tests/mcp/files.spec.ts to understand upload handling, modal guards, and the two-step flow. The proposal requires coordinating chooser timing, existing target and file validation, failure cleanup, and tests. Done means an optional atomic upload action works with deterministic errors and preserves the existing APIs and access restrictions.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What's going on?
Feature request: optional one-call file picker upload
The current Playwright MCP workflow for an element that opens a native file chooser is intentionally two-step:
browser_click({ element: "Choose file", target: "e2" })browser_file_upload({ paths: ["/workspace/example.txt"] })
While the chooser is pending, the MCP backend correctly restricts other tab tools. This is not a report of a broken modal guard. I'd like to propose an optional atomic action that performs both steps within one tool invocation, without changing existing APIs.
Reproduction / motivation
Tested on @playwright/[email protected] (current published npm version on 2026-10-20), Node.js 22 and Chrome in an isolated headless browser. The page was served locally and contained only a button that clicks a hidden <input type="file">, a harmless second button, and a status text node.
browser_navigateandbrowser_snapshot: succeed.browser_clickon the upload trigger: succeeds; response reports[File chooser]modal state.browser_snapshotwhile that chooser is pending: returnsTool "browser_snapshot" does not handle the modal state.(7 ms).- Clicking the unrelated button: similarly blocked (14 ms).
browser_file_upload({}): clears the modal state; the next snapshot succeeds.- Reopen chooser, call
browser_file_upload({ paths: [file] }): file selected and the next snapshot succeeds.
This confirms expected current behavior, not a reproduced upstream hang. The remaining gap is orchestration: when an agent's upload steps are interrupted, retried, or interleaved with another tool call, it can be left in a chooser-only state requiring separate recovery. This is particularly awkward for long-running agent workflows and extension-connected tabs.
Proposal
Consider an opt-in browser_upload_files tool (name/API flexible), roughly:
{ "element": "Choose file button", "target": "e2", "paths": ["/workspace/example.txt"] }
Expected behavior:
- Validate
targetusing the existing browser target resolution and validatepathsusing the existing workspace/file-access restrictions. - Click the target and wait for the newly opened file chooser within a bounded timeout.
- Set files using the existing upload implementation and return the resulting snapshot/status.
- If no chooser opens, fail with a clear error; do not consume an unrelated previously pending chooser. Define safe, deterministic cleanup/retry semantics for failure.
- Preserve
browser_clickandbrowser_file_uploadunchanged for backwards compatibility. No relaxation of browser permissions or file access.
The existing defineTabTool modal guard and tests already cover the two-step flow; this proposal would add an optional higher-level operation, not remove the guard. See packages/playwright-core/src/tools/backend/{files.ts,tool.ts} and tests/mcp/files.spec.ts.
Could maintainers advise whether this belongs upstream? I can contribute a focused implementation and tests if this issue is approved/assigned, per the contributing guidelines. No production website or private user data was used for the reproduction.
Version
@playwright/mcp 0.0.83 (npm); upstream main 27219bd2cc94e1ebceec58f188760a6bf458c192
- Lenguaje dominante
- TypeScript
- Estrellas
- 98k
- Forks
- 6.6k
- Merge medio
- 16 h 20 min
- PR fusionados (30 d)
- 301
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/playwright
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
microsoft/playwright#43581 · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
[Feature]: Set `this.name` in `TargetClosedError` constructorQuizá libre de nuevo @LeonxLJX la tomó hace 49 días y no hay ningún pull request abierto. AbiertoP3-collecting-feedback
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
microsoft/playwright#42522 · 7 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
microsoft/playwright#43586 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
microsoft/playwright#43587 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 55/100
microsoft/playwright#43588 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/playwright
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
db-ux-design-system/core-web#8613 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug:new
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
callstackincubator/simlock#934 ·
Los mantenedores suelen responder en 1 día
-
Log page not working after errorAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
gchq/LD-Explorer#286 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
foxglove/mcap#1907 · 1 comentario ·
Los mantenedores suelen responder en 1 día