Class: Profiler::MCP::Tools::SetEnvVar

Inherits:
Object
  • Object
show all
Defined in:
lib/profiler/mcp/tools/set_env_var.rb

Class Method Summary collapse

Class Method Details

.call(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/profiler/mcp/tools/set_env_var.rb', line 7

def self.call(params)
  key = params["key"].to_s.strip
  value = params["value"].to_s

  return [{ type: "text", text: "Error: key cannot be blank." }] if key.empty?

  Profiler.env_override_store.set(key, value)
  ENV[key] = value

  [{ type: "text", text: "Set #{key}=#{value}" }]
end