Uh oh!
There was an error while loading. Please reload this page.
feat(mcp): add browser_emulate_media tool and --color-scheme option - #42244
feat(mcp): add browser_emulate_media tool and --color-scheme option#42244Lars Kiesow (lkiesow) wants to merge 1 commit into
Conversation
Lets agents check a UI in both light and dark mode. The tool wraps page.emulateMedia, so reduced motion, forced colors, contrast and the print media type are covered as well. Omitted parameters keep their current emulation state. --color-scheme (and PLAYWRIGHT_MCP_COLOR_SCHEME) maps to contextOptions.colorScheme so a whole session can start in dark mode. Fixesmicrosoft#42243
Lars Kiesow (lkiesow)
commented
Aug 13, 2026
Sorry, in the contributor.md, I missed the
Closing this for now, but happy to provide the patch again |
Pavel Feldman (pavelfeldman)
commented
Aug 14, 2026
Your patch looks good, please feel free to reopen it as is. I'd probably have playwright-cli set- in the CLI instead of passing camelCase options though. |
Lars Kiesow (@lkiesow) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| description: 'Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged.', | ||
| inputSchema: z.object({ | ||
| colorScheme: z.enum(['light', 'dark']).optional().describe('Emulates the prefers-color-scheme media feature'), | ||
| reducedMotion: z.enum(['reduce', 'no-preference']).optional().describe('Emulates the prefers-reduced-motion media feature'), |
There was a problem hiding this comment.
let's use kebob case to be consistent with other options
Test results for "MCP"6 failed 8171 passed, 1391 skipped Merge workflow run. |
Lets agents check a UI in both light and dark mode. The tool wraps page.emulateMedia, so reduced motion, forced colors, contrast and the print media type are covered as well. Omitted parameters keep their current emulation state.
--color-scheme (and PLAYWRIGHT_MCP_COLOR_SCHEME) maps to contextOptions.colorScheme so a whole session can start in dark mode.
Fixes#42243