Class: Profiler::MCP::Tools::ClearProfiles

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

Class Method Summary collapse

Class Method Details

.call(params) ⇒ Object



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

def self.call(params)
  type = params["type"]

  if type && !%w[http job].include?(type)
    return [{ type: "text", text: "Error: type must be 'http' or 'job'" }]
  end

  Profiler.storage.clear(type: type)

  label = type ? "#{type} profiles" : "all profiles (requests and jobs)"
  [{ type: "text", text: "Cleared #{label}." }]
end