chore: allow taking pixel screenshots in snapshot mode (#44)

Ref: https://github.com/microsoft/playwright-mcp/issues/39
This commit is contained in:
Pavel Feldman 2025-03-27 07:27:34 -07:00 committed by GitHub
parent 702fa0bdf3
commit d4bc2c78d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 37 additions and 6 deletions

View file

@ -29,7 +29,7 @@ export const screenshot: Tool = {
},
handle: async context => {
const page = await context.existingPage();
const page = context.existingPage();
const screenshot = await page.screenshot({ type: 'jpeg', quality: 50, scale: 'css' });
return {
content: [{ type: 'image', data: screenshot.toString('base64'), mimeType: 'image/jpeg' }],
@ -55,7 +55,7 @@ export const moveMouse: Tool = {
handle: async (context, params) => {
const validatedParams = moveMouseSchema.parse(params);
const page = await context.existingPage();
const page = context.existingPage();
await page.mouse.move(validatedParams.x, validatedParams.y);
return {
content: [{ type: 'text', text: `Moved mouse to (${validatedParams.x}, ${validatedParams.y})` }],