-
Notifications
You must be signed in to change notification settings - Fork 4.8k
chore(mcp): cap image size #37856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(mcp): cap image size #37856
Conversation
97bf8b2 to
c0192e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements image size capping for MCP browser screenshot functionality to comply with Claude's vision API requirements. The changes cap images at 1.15 megapixels and maximum linear dimension of 1568 pixels.
- Introduces image scaling functionality to reduce large screenshots before sending to LLM
- Refactors image utilities to make them reusable across the codebase
- Adds comprehensive test coverage for the new image size capping behavior
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mcp/screenshot.spec.ts | Adds test cases for image size capping with various dimensions |
| packages/playwright/src/mcp/browser/tools/screenshot.ts | Implements image scaling logic and removes conditional image return |
| packages/playwright-core/src/utils.ts | Exports new imageUtils module |
| packages/playwright-core/src/server/utils/imageUtils.ts | New utility module with image scaling and padding functions |
| packages/playwright-core/src/server/utils/comparators.ts | Refactors to use shared image utilities |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
c0192e2 to
7cdef9f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pavel Feldman <pavel.feldman@gmail.com>
This comment has been minimized.
This comment has been minimized.
Test results for "MCP"2557 passed, 108 skipped Merge workflow run. |
Test results for "tests 1"1 failed 2 flaky47032 passed, 816 skipped Merge workflow run. |
This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [@playwright/mcp](https://playwright.dev) ([source](https://redirect.github.com/microsoft/playwright-mcp)) | [`0.0.42` -> `0.0.43`](https://renovatebot.com/diffs/npm/@playwright%2fmcp/0.0.42/0.0.43) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>microsoft/playwright-mcp (@​playwright/mcp)</summary> ### [`v0.0.43`](https://redirect.github.com/microsoft/playwright-mcp/releases/tag/v0.0.43) [Compare Source](https://redirect.github.com/microsoft/playwright-mcp/compare/v0.0.42...v0.0.43) ##### MCP Changes Since Last Release - **Incremental page snapshots**: `pageState` now supports diffs. Unchanged subtrees are collapsed as `- ref=<id> [unchanged]`. Reduces noise and payload size. [microsoft/playwright#37795](https://redirect.github.com/microsoft/playwright/issues/37795) - **Encourage relative path usage** — MCP now suggests using relative paths for portability [microsoft/playwright#37857](https://redirect.github.com/microsoft/playwright/issues/37857) - **Image size cap** — Added limits on rendered image sizes to prevent resource overuse [microsoft/playwright#37856](https://redirect.github.com/microsoft/playwright/issues/37856) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/izumin5210/dotfiles). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE0My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
No description provided.