Class: Sidekiq::Mcp::Tools::KillJobTool

Inherits:
Sidekiq::Mcp::Tool show all
Defined in:
lib/sidekiq/mcp/tools/kill_job_tool.rb

Instance Method Summary collapse

Methods inherited from Sidekiq::Mcp::Tool

arguments, #call, description, schema_to_json_schema, to_tool_definition

Instance Method Details

#perform(jid:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sidekiq/mcp/tools/kill_job_tool.rb', line 16

def perform(jid:)
  # Try retry set first
  retry_set = Sidekiq::RetrySet.new
  job = retry_set.find_job(jid)
  
  if job
    job.kill
    return "Job #{jid} moved from retry set to dead set"
  end
  
  # Try scheduled set
  scheduled_set = Sidekiq::ScheduledSet.new
  job = scheduled_set.find_job(jid)
  
  if job
    job.kill
    return "Job #{jid} moved from scheduled set to dead set"
  end
  
  "Job #{jid} not found in retry or scheduled sets"
end