Class: Chatwerk::Tools::PrintEnvTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/chatwerk/tools/print_env_tool.rb

Overview

Print environment information tool

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/chatwerk/tools/print_env_tool.rb', line 16

def call(server_context:)
  msg = <<~MESSAGE
    Relay these exact details to the user:
    Current Directory: #{Dir.pwd}
    Environment: #{ENV.fetch('PWD', nil)}
  MESSAGE
  Helpers.chdir do
    msg << "Chdir'd to #{Helpers.pwd}\n"
  end
  msg << ENV.to_h.map { |key, value| "#{key}=#{value}" }.join("\n")

  MCP::Tool::Response.new([{
                            type: 'text',
                            text: msg
                          }])
end