Class: Sidekiq::Mcp::Tools::ListScheduledJobsTool

Inherits:
Sidekiq::Mcp::Tool show all
Defined in:
lib/sidekiq/mcp/tools/list_scheduled_jobs_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(limit: 10) ⇒ Object



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

def perform(limit: 10)
  jobs = Sidekiq::ScheduledSet.new.first(limit).map do |job|
    {
      jid: job.jid,
      class: job.klass,
      args: job.args,
      queue: job.queue,
      scheduled_at: job.at,
      created_at: job.created_at
    }
  end
  
  {
    total_size: Sidekiq::ScheduledSet.new.size,
    jobs: jobs
  }.to_json
end