playwright-e2e-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | Logging level: debug | info | warn | error | silent. Logs always go to stderr — stdout is reserved for the MCP protocol. | info |
| LOG_FORMAT | No | Log format: text or json (structured). | text |
| PW_MCP_PROJECT_ROOT | No | Default project root for every tool. Set this when the client launches the server somewhere other than your project directory (e.g. your home directory). | server cwd |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| run-testA | Run the project's Playwright tests: stats plus each failure's file:line, kind and message. Diagnoses missing installs, dead dev servers, syntax errors, crashes and timeouts (kills the tree, keeps partial results). Reports progress; background: true returns a run id for long suites. Runs are recorded for analyze-history. |
| get-run-statusA | Progress (tests done/total, failures so far) or the final result of a run-test background run; the result becomes the last run for get-failure. waitSeconds waits; cancel stops it. Default: the latest run. |
| get-failureA | Analyze one failure from the most recent run-test execution: full message and code frame, expected vs actual, stack trace, failed network requests (4xx/5xx and dead endpoints), console errors, failure kind (assertion/timeout/browser-crash/syntax/config/server-unreachable) and concrete next steps. Use run-test first. |
| suggest-fixA | Patch a failure from the last run: a drifted locator is matched against the DOM at failure (trace, or live url) and replaced with one proven unique; changed copy gets the new expected text. Returns a diff and confidence; apply: true writes it, re-runs the test and reverts if still red. Refuses when the element is truly missing (app bug). |
| inspect-pageA | Open a URL headlessly and return its elements with Playwright locators proven unique on the page (role + name first), CSS selectors, visibility, text and console messages. storageState/headers open it signed in; actions click/fill first to reach a state. view 'locators' is the compact map. |
| list-testsA | List the Playwright tests available in the project (file, line, full title, projects), with optional filtering. Uses |
| validate-selectorA | Check a CSS selector, Playwright selector or locator (getByRole/getByTestId…, .first(), .filter()) on a live page: validity, match count (actions need exactly 1), sample matches and a sturdier verified locator for each. Accepts storageState/headers/actions. |
| generate-e2e-testA | Scaffold a Playwright test from a description using the project's REAL selectors. Scans the agent's recent file changes (git working tree / last commit, mtime fallback), extracts data-testid / role / label / placeholder / id locators with their source locations, optionally cross-checks them against the live page, writes a ready-to-run spec, and returns next steps. |
| compare-visual-stateA | Visual regression check: screenshot a live page (or element), compare it to a stored baseline, and report how many pixels changed, WHERE they changed (bounding regions), and the average color shift ("blue → red"). First call saves the baseline; later calls compare. Writes a red-highlighted diff image for review. |
| diagnose-flakyA | Run a failing test multiple times with retries disabled and return an evidence-based verdict: CONSISTENTLY FAILING (real bug), FLAKY (intermittent — includes pass/fail counts and error-signature variance) or NOT REPRODUCING (one-off). Defaults to the tests that failed in the most recent run. |
| analyze-historyA | Analyze the local run history (.playwright-e2e-mcp/history.jsonl, written by every run): 'flaky' ranks tests that flip pass/fail and lists broken or regressed ones; 'patterns' groups failures by cause; 'test' shows one test's timeline. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| fix-failing-test | Run the tests, diagnose the first failure, apply a verified fix or explain the real bug. |
| triage-flaky-tests | Rank unstable tests from the local run history and diagnose the worst one. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 11 tools
Tools map to distinct stages of the Playwright workflow: listing, running, monitoring, failure analysis, fixing, generation, visual comparison, selector validation, flaky diagnosis, and history. Overlap exists between diagnose-flaky and analyze-history, and between get-failure and get-run-status, but descriptions clarify the boundaries.
All tool names use kebab-case with a consistent verb-first pattern (run-test, get-failure, list-tests, validate-selector, etc.). Minor variation in noun length does not break the convention.
11 tools is well within the ideal 3–15 range. Each tool addresses a distinct aspect of Playwright E2E testing without obvious redundancy.
The core lifecycle is well covered: list tests, run tests, monitor runs, analyze failures, suggest fixes, generate tests, validate selectors, compare visual state, diagnose flakiness, and analyze history. Minor gaps include running a specific test or reading a single test's code, but agents can work around these.