Class: WritersRoom::ReadFileTool
- Inherits:
-
ProjectTool
- Object
- RobotLab::Tool
- ProjectTool
- WritersRoom::ReadFileTool
- Defined in:
- lib/writers_room/tools/read_file_tool.rb
Overview
LLM tool that reads file contents within the project directory.
Instance Attribute Summary
Attributes inherited from ProjectTool
Instance Method Summary collapse
Methods inherited from ProjectTool
Constructor Details
This class inherits a constructor from WritersRoom::ProjectTool
Instance Method Details
#execute(path:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/writers_room/tools/read_file_tool.rb', line 14 def execute(path:) full_path = resolve_path(path) return "File not found: #{path}" unless File.exist?(full_path) return "Not a file: #{path}" unless File.file?(full_path) File.read(full_path) rescue RuntimeError => e e. rescue StandardError => e "Error reading file: #{e.}" end |