playwright-trace-doctor
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@playwright-trace-doctor Triage the latest Playwright trace and pinpoint the root cause"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π©Ί Playwright Trace Doctor
The Instant MRI for Broken Web Tests.
When Playwright tests fail in CI, donβt waste hours digging through 50MB trace files. Trace Doctor pinpoints whether your UI broke or your backend crashedβand generates the exact self-healing fix code in under a second.
β‘ The Pain It Solves
The Downstream Casualty Trap: In modern web apps, a button click timeout is almost never a button bugβit's usually caused by a silent upstream
HTTP 500on an API route. Standard test runners only reportTimeout 30000ms exceeded, sending developers on wild goose chases.Binary Blindspot for AI Coding Agents: AI coding agents (Antigravity, Cursor, Claude Code) only receive truncated terminal logs. They cannot read Playwrightβs binary
trace.ziparchives, forcing them to hallucinate inaccurate fixes.Tool-Sprawl in Existing Decoders: Existing trace MCP servers force AI agents to make 6β10 consecutive tool roundtrips (
open_traceβlist_actionsβget_actionβget_networkβget_consoleβget_dom), blowing token limits and stalling agent execution.
Related MCP server: playwright-generate-mcp
π The Solution
playwright-trace-doctor provides one-shot, token-budgeted triage and self-healing recommendations in a single call (< 5ms latency, < 1.5k tokens).
ββββββββββββββββββββββββββββββββββ
β Playwright trace.zip β
β (Actions, DOM, Network, Log) β
βββββββββββββββββ¬βββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββ
β π©Ί Playwright Trace Doctor β
β - In-Memory Streaming Parser β
β - Upstream 5xx/4xx Correlator β
β - Heuristic Root Cause Engine β
β - Self-Healing Fix Generator β
βββββββββββββββββ¬βββββββββββββββββ
β
βββββββββ΄ββββββββ
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β Terminal CLI β β MCP Server β
β (Human PRs) β β (AI Agents) β
ββββββββββββββββ ββββββββββββββββπ Benchmark vs Existing Decoders
Tested across 5 real-world stress scenarios (Strict Mode Violations, Pointer Interceptions, Missing Locators, Downstream 500s, and Web-First Assertion Mismatches):
Metric | Existing Decoders | Playwright Trace Doctor |
Agent Roundtrips | 6β10 fragmented tool calls | 1-Shot Holistic Triage ( |
Upstream Causality | Ignored | Correlates 4xx/5xx network failures to UI timeouts |
Self-Healing Code | None (raw JSON dumps) | Generates resilient Playwright locator replacements |
Trace Auto-Discovery | Requires manual file path | Auto-detects latest trace in |
CLI Mode | MCP-only | Dual-mode: Rich Terminal CLI + Stdio MCP |
Diagnostic Latency | ~500msβ2000ms | ~3.2ms average execution time |
Token Consumption | 20kβ50k tokens | < 1.5k tokens (strict token guard) |
π¦ Quick Start
1. One-Command Setup (Zero Config)
Run in any Playwright project repository:
# Auto-detect Playwright config, wire GitHub Actions CI failure autopsy & register MCP
npx playwright-trace-doctor init
# Preview changes without modifying disk
npx playwright-trace-doctor init --dry-run2. Terminal CLI (Local & CI Usage)
# Auto-discover and triage the latest failed trace in the project
npx playwright-trace-doctor --latest
# Direct path inspection
npx playwright-trace-doctor path/to/trace.zip
# Output clean Markdown (ideal for GitHub Actions / PR comments)
npx playwright-trace-doctor --latest --markdown
# Output structured JSON
npx playwright-trace-doctor --latest --json3. Reusable GitHub Action (CI Autopsy & Sticky PR Comments)
Add directly to your .github/workflows/playwright.yml:
- name: Autopsy Broken Playwright Tests
if: failure()
uses: Pranav-Nexus/playwright-trace-doctor@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
post-pr-comment: true4. Model Context Protocol (MCP) Setup
Add to your MCP configuration (antigravity.json, .cursor/mcp.json, or claude_desktop_config.json):
{
"mcpServers": {
"trace-doctor": {
"command": "npx",
"args": ["-y", "playwright-trace-doctor", "mcp"]
}
}
}π οΈ MCP Tools Reference
1. triage_failure (Primary Tool)
One-shot diagnostic of a Playwright failure trace. Extracts failing locator, stack trace, classified root cause, correlated network 4xx/5xx requests, console errors, and resilient self-healing fix code. Automatically finds latest trace if tracePath is omitted.
2. find_latest_trace
Scans project subdirectories (test-results/, playwright-report/, .playwright-artifacts/) and returns the newest trace file with file metadata.
3. get_failed_network_calls
Extracts only aborted, 4xx, and 5xx HTTP requests captured during the test run.
4. suggest_locator_fixes
Analyzes a fragile CSS or XPath selector and suggests resilient Playwright locators (getByRole, getByTestId, web-first auto-await assertions).
π§ͺ Comprehensive Stress Testing
Run the built-in 5-suite stress benchmark simulating authentic browser crashes:
# Run the automated stress benchmark
npm run test:stressOutput:
============================================================
π§ͺ RUNNING PLAYWRIGHT TRACE DOCTOR STRESS BENCHMARK (5 SUITES)
============================================================
β
Suite [strict-mode]: Strict Mode Violation (Multiple Elements)
Expected: STRICT_MODE_VIOLATION | Detected: STRICT_MODE_VIOLATION
Perf: Parse 4.19ms, Analysis 0.81ms (Total: 5.00ms)
Fixes Suggested: 2
------------------------------------------------------------
β
Suite [pointer-intercept]: Pointer Events Intercepted (Modal Overlay)
Expected: POINTER_INTERCEPTED | Detected: POINTER_INTERCEPTED
Perf: Parse 2.28ms, Analysis 0.22ms (Total: 2.50ms)
Fixes Suggested: 2
------------------------------------------------------------
β
Suite [locator-timeout]: Locator Timeout (Element Missing in DOM)
Expected: TIMEOUT_LOCATOR_NOT_FOUND | Detected: TIMEOUT_LOCATOR_NOT_FOUND
Perf: Parse 1.88ms, Analysis 0.19ms (Total: 2.07ms)
Fixes Suggested: 3
------------------------------------------------------------
β
Suite [backend-500]: Backend API 500 Failure with Downstream Timeout
Expected: BACKEND_API_FAILURE | Detected: BACKEND_API_FAILURE
Perf: Parse 2.35ms, Analysis 0.15ms (Total: 2.50ms)
Fixes Suggested: 1
------------------------------------------------------------
β
Suite [assertion-failure]: Assertion Mismatch Failure (expect.toHaveText)
Expected: ASSERTION_FAILED | Detected: ASSERTION_FAILED
Perf: Parse 1.89ms, Analysis 0.18ms (Total: 2.07ms)
Fixes Suggested: 2
------------------------------------------------------------
============================================================
π STRESS TEST SUMMARY: 5/5 PASSED (100% Target)
============================================================π License
MIT Β© 2026 Pranav H
Available Tools
4 toolsfind_latest_traceFind Latest Playwright TraceARead-onlyIdempotent
Recursively searches test-results/, playwright-report/, and project subdirectories under baseDir (defaults to cwd) for the newest Playwright trace.zip file. Returns JSON with { found, tracePath, sizeBytes, lastModified }, or { found: false, message } when no trace exists (does not throw on empty results). Use before other tools to verify a trace exists or inspect its timestamp; do not use when you already have a tracePath and want immediate triage (use triage_failure directly).
Inputs: baseDir.
get_failed_network_callsGet Failed Network CallsARead-onlyIdempotent
Extracts all HTTP 4xx/5xx responses and aborted/failed requests across a Playwright trace.zip and returns JSON { tracePath, totalRequests, failedRequestsCount, failedRequests }. If tracePath (local .zip path) is omitted, auto-discovers the latest trace under cwd; returns an error if no trace exists. Use when debugging API/backend failures in isolation; prefer triage_failure for full root-cause, console, and locator analysis.
Inputs: tracePath.
suggest_locator_fixesSuggest Resilient Locator FixesARead-onlyIdempotent
Analyzes a failing Playwright selector from a trace.zip (or customSelector, e.g. "button#pay") against recorded DOM state and returns advisory JSON { failingSelector, failureClassification, recommendations } (getByRole, getByTestId, auto-await) without editing test files. Defaults to the latest trace under cwd if tracePath is omitted; returns an error if no trace exists, or undefined failingSelector with general recommendations if no action failed. Use when you only need selector replacements; prefer triage_failure for full failure diagnosis or non-selector failures.
Inputs: tracePath, customSelector.
triage_failureTriage Playwright Failure TraceARead-onlyIdempotent
Diagnose a Playwright failure trace.zip and return advisory fix recommendations as Markdown + JSON (classification, failedAction, networkErrors, consoleErrors, recommendations, tracePath) without modifying any files. If tracePath (local path to a .zip trace archive) is omitted, auto-discovers the newest trace under cwd; returns an error if no trace exists or the archive is unreadable. Use as the default entry point for full failure triage; prefer get_failed_network_calls or suggest_locator_fixes when you only need that single slice, or find_latest_trace to check trace existence first.
Inputs: tracePath.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
Each tool has a clear focus, and the descriptions explicitly cross-reference when to use triage_failure versus the single-slice tools (network, locator, trace discovery). There is real hierarchical overlap since triage_failure's output subsumes networkErrors and locator recommendations, so an agent may default to it, but the guidance mitigates misselection.
All four names follow a consistent snake_case verb_phrase pattern: triage_failure, find_latest_trace, get_failed_network_calls, suggest_locator_fixes. The verbs differ appropriately by action while the structure stays predictable.
Four tools is well-scoped for a narrow trace-diagnosis server: one entry point, one discovery helper, and two targeted slices. Each tool has a distinct, defensible role with no filler.
The surface covers trace discovery, full triage, network failure extraction, and locator suggestions β the core diagnostic lifecycle. Minor gaps remain: no standalone console-error extraction, no timing/flakiness or retry analysis, and no way to compare or list multiple traces.
Maintenance
Related MCP Connectors
Diagnose why an AI agent failed and get the verified fix instantly. Free, no token.
Finds what's broken in your product, explains why, and fixes it from your agent.
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Browser-backed QA with evidence and fix-ready reports for coding agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceSupercharges AI-assisted debugging of Playwright tests by parsing trace files to extract failures, action history, network logs, screenshots, and suggesting fixes.6-
- AlicenseAqualityBmaintenanceEnables AI coding assistants to generate, score, run, and auto-heal Playwright E2E tests while enforcing domain-driven page object architecture and anti-flakiness rules.8MIT
- AlicenseAqualityCmaintenanceProvides AI coding agents with reliable root-cause diagnosis and minimal, high-confidence fixes for failing tests.31MIT
- AlicenseAqualityBmaintenanceEnables AI agents to run, debug, and inspect Playwright end-to-end tests, returning structured pass/fail stats, failure diagnostics with actionable fix hints, live DOM inspection, selector validation, visual diffs, and flakiness verdicts instead of raw test output.11MIT