Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
saveToparameter for screenshot tools, optimizing screenshot handling especially for CLI-based Model Context Protocol (MCP) clients like Claude Code. Screenshots can now be saved directly to disk, reducing context window bloat. The response format for screenshots has also been improved, and the codebase and tests have been updated to support these changes.Screenshot tool enhancements:
saveToparameter to bothscreenshot_pageandscreenshot_by_uidtools, allowing screenshots to be saved to a specified file path instead of returning base64 data in the response. This helps prevent large context payloads in CLI environments. IfsaveTois provided, the tool returns a lightweight text response with the file path and size, and automatically creates parent directories as needed. [1] [2] [3] [4] [5] [6]saveTois not provided, screenshot responses now use native MCPimagecontent ({ type: "image" }), which GUI clients can render directly. The previousbuildScreenshotResponsewith token-limit truncation has been removed. [1] [2] [3] [4] [5]Type and interface updates:
McpToolResponsetype to support bothtextandimagecontent items, ensuring proper typing for the new response formats. [1] [2] [3] [4]Documentation improvements:
README.mdandCHANGELOG.mdto document the newsaveToparameter, describe its benefits for CLI environments, and explain the new response formats. [1] [2] [3]Testing enhancements:
saveTobehavior, including checks for file creation, parent directory creation, and correct response formats for both file and image outputs. [1] [2]Versioning:
0.7.0and updated related tests and constants. [1] [2] [3] [4]…tests