feat: add filePath parameter to take_snapshot and evaluate_script#248
Closed
Coquinate wants to merge 2 commits intoChromeDevTools:mainfrom
Closed
feat: add filePath parameter to take_snapshot and evaluate_script#248Coquinate wants to merge 2 commits intoChromeDevTools:mainfrom
Coquinate wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
Collaborator
|
Hey, Could you please incorporate those in this PR and will review after. |
Contributor
Author
|
Updated to use |
Add optional filePath parameter to save tool output directly to files instead of including in response. Features: - take_snapshot can save accessibility tree to file - evaluate_script can save JSON result to file - Reduces token usage for large outputs - Enables offline analysis and processing - Backwards compatible - tools work as before when filePath is omitted Implementation: - Added filePath optional parameter to both tool schemas - Write formatted output to file using writeFile from node:fs/promises - Updated Context interface to expose createTextSnapshot and getTextSnapshot - Includes comprehensive tests for file saving functionality Resolves ChromeDevTools#153
Updates take_snapshot and evaluate_script to use context.saveFile() instead of direct writeFile() calls, following the pattern established in PR ChromeDevTools#250. Changes: - Removed direct fs/promises imports - Convert string data to Uint8Array using TextEncoder - Use context.saveFile() for consistent file writing - Update response messages to use returned filename 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
f4b451c to
acaabdc
Compare
Collaborator
|
Could you please sign the CLA (see the failing check) https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/248/checks?check_run_id=52444256994? |
Collaborator
|
Closing due to conflicts. It is partially addressed by other PRs and we have tracking issues for remaining feature requests. |
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.
Summary
Adds optional
filePathparameter totake_snapshotandevaluate_scripttools, enabling direct file output instead of response inclusion.Resolves #153
Features
take_snapshotcan save accessibility tree to fileevaluate_scriptcan save JSON result to fileImplementation
filePathparameter to both tool schemaswriteFilefromnode:fs/promisesContextinterface to exposecreateTextSnapshotandgetTextSnapshottake_screenshottoolTesting
Test Plan