11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rails-mcp-server/tools/get_file.rb', line 11
def call(path:)
unless current_project
message = "No active project. Please switch to a project first."
log(:warn, message)
return message
end
full_path = File.join(active_project_path, path)
unless File.exist?(full_path)
message = "File '#{path}' not found in the project."
log(:warn, message)
return message
end
content = File.read(full_path)
log(:debug, "Read file: #{path} (#{content.size} bytes)")
"File: #{path}\n\n```#{get_file_extension(path)}\n#{content}\n```"
end
|