19. Deep Read: FileReadTool
What Makes FileReadTool Interesting
This is not a simple file read wrapper. It handles token-aware reading, image and PDF support, line-based reading, notebook conversion, memory freshness notes, blocked device paths, session-file analytics, and path normalization across platforms.
Important Design Choices
- Dangerous pseudo-files such as
/dev/zeroand stdio aliases are blocked without reading them. - Large or rich files are handled according to file type instead of forcing one text-only path.
- Read permissions are integrated with wildcard-based filesystem rules.
- Reading is shaped for model consumption, not just for returning bytes.
Main Lesson
“Read file” in an agent product is really a content preparation pipeline. It must care about safety, token cost, file type,
human readability, and future tool interactions.
Source Navigation
Recommended Source Files
source/tools/FileReadTool/FileReadTool.tssource/tools/FileReadTool/limits.tssource/tools/FileReadTool/prompt.tssource/tools/FileReadTool/types.tssource/Tool.ts
Next Files to Read
source/tools/FileEditTool/FileEditTool.tssource/tools/FileEditTool/utils.tssource/tools/GlobTool