Class: Sidekiq::Mcp::Tools::RescheduleJobTool
- Inherits:
-
Sidekiq::Mcp::Tool
- Object
- Sidekiq::Mcp::Tool
- Sidekiq::Mcp::Tools::RescheduleJobTool
- Defined in:
- lib/sidekiq/mcp/tools/reschedule_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:, new_time:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sidekiq/mcp/tools/reschedule_job_tool.rb', line 17 def perform(jid:, new_time:) begin = Time.parse(new_time) rescue ArgumentError return "Invalid time format. Please use ISO 8601 format (e.g., '2024-12-25T10:00:00Z')" end scheduled_set = Sidekiq::ScheduledSet.new job = scheduled_set.find_job(jid) if job old_time = job.at job.reschedule() "Job #{jid} rescheduled from #{old_time} to #{new_timestamp}" else "Job #{jid} not found in scheduled set" end end |