chore: do not return fullPage screenshots to the LLM (#849)

This commit is contained in:
Pavel Feldman
2025-08-08 09:36:51 -07:00
committed by GitHub
parent 6c2dda31ad
commit 16f3523317
2 changed files with 10 additions and 10 deletions

View File

@@ -75,10 +75,15 @@ const screenshot = defineTabTool({
const buffer = locator ? await locator.screenshot(options) : await tab.page.screenshot(options);
response.addResult(`Took the ${screenshotTarget} screenshot and saved it as ${fileName}`);
response.addImage({
contentType: fileType === 'png' ? 'image/png' : 'image/jpeg',
data: buffer
});
// https://github.com/microsoft/playwright-mcp/issues/817
// Never return large images to LLM, saving them to the file system is enough.
if (!params.fullPage) {
response.addImage({
contentType: fileType === 'png' ? 'image/png' : 'image/jpeg',
data: buffer
});
}
}
});