MCPcopy Create free account
hub / github.com/github/gh-aw / validatePlaywrightMode

Method validatePlaywrightMode

pkg/workflow/playwright_validation.go:43–70  ·  view source on GitHub ↗

validatePlaywrightMode warns when the playwright tool is configured in MCP mode. MCP mode is deprecated; use mode: cli instead for token-efficient, container-free browser automation.

(workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

41// mode. MCP mode is deprecated; use mode: cli instead for token-efficient,
42// container-free browser automation.
43func (c *Compiler) validatePlaywrightMode(workflowData *WorkflowData) error {
44 if workflowData == nil || workflowData.Tools == nil {
45 return nil
46 }
47
48 playwrightTool, ok := workflowData.Tools["playwright"]
49 if !ok || playwrightTool == false {
50 return nil
51 }
52
53 if isPlaywrightCLIMode(workflowData.Tools) {
54 playwrightValidationLog.Print("playwright mode: cli — no deprecation warning")
55 return nil
56 }
57
58 playwrightValidationLog.Print("playwright mode: mcp detected — emitting deprecation warning")
59
60 warningMsg := "tools.playwright: MCP mode is deprecated. " +
61 "Migrate to CLI mode by adding `mode: cli` to your playwright configuration. " +
62 "CLI mode runs playwright-cli directly on the runner (no Docker container required), " +
63 "is more token-efficient, and lets you use `localhost` to reach local dev servers. " +
64 "Update your prompts to run `playwright-cli <command>` in bash instead of using MCP browser tools. " +
65 "See: https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/playwright.md"
66
67 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(warningMsg))
68 c.IncrementWarningCount()
69 return nil
70}

Calls 4

IncrementWarningCountMethod · 0.95
FormatWarningMessageFunction · 0.92
isPlaywrightCLIModeFunction · 0.85
PrintMethod · 0.80

Tested by 2