feat(tools): add image support to read_file tool#5172
Merged
mrubens merged 21 commits intoRooCodeInc:mainfrom Jul 29, 2025
Merged
feat(tools): add image support to read_file tool#5172mrubens merged 21 commits intoRooCodeInc:mainfrom
mrubens merged 21 commits intoRooCodeInc:mainfrom
Conversation
0ad2410 to
e85d4d5
Compare
119bc82 to
df342d7
Compare
daniel-lxs
reviewed
Jul 2, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Hey @samhvw8, I know that different providers have different implementations for image handling, so I'm concerned this centralized approach might break with some providers.
Should we use the provider specific implementations for reading images?
Let me know what you think.
- Extract image-related constants and functions to src/core/tools/helpers/imageHelpers.ts - Keep readFileTool.ts focused on the main file reading logic - Update imports in test file to use the new helper module - All tests passing after refactoring
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
85d7699 to
1dc79ce
Compare
Member
|
Hey @samhvw8 thank you for addressing the review! I noticed an unit test is failing, can you take a look? |
Contributor
Author
|
@daniel-lxs i fixed the test can you review it again |
- Replace maxTotalImageMemory with maxTotalImageSize throughout codebase - Update all translation files with new terminology - Fix incorrect key names in pt-BR, zh-CN, and zh-TW translations - Improve clarity of size limit messages - Update tests to reflect new terminology
- Extract image validation logic into validateImageForProcessing function - Extract image processing logic into processImageFile function - Add ImageMemoryTracker class to encapsulate memory tracking - Add proper TypeScript interfaces for validation and processing results - Reduce code duplication and improve separation of concerns
mrubens
approved these changes
Jul 29, 2025
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.
Related GitHub Issue
Closes: #5169
Description
Test Procedure
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Important
Adds image support to
read_filetool, enabling reading and displaying images as base64 data URLs with comprehensive test coverage.read_filetool inreadFileTool.ts, supporting formats like PNG, JPG, GIF, etc.readImageAsDataUrl()to convert images to base64 data URLs.readFileTool.spec.tsfor image reading, format detection, error handling, and edge cases.fs/promisesand other dependencies for testing.SUPPORTED_IMAGE_FORMATSandMAX_IMAGE_FILE_SIZE_BYTESconstants inreadFileTool.ts.This description was created by
for 3214f02b7b429926adb744e5911e9c1a4cc5858a. You can customize this summary. It will automatically update as commits are pushed.