Class: Sidekiq::Mcp::Tools::JobDetailsTool
- Inherits:
-
Sidekiq::Mcp::Tool
- Object
- Sidekiq::Mcp::Tool
- Sidekiq::Mcp::Tools::JobDetailsTool
- Defined in:
- lib/sidekiq/mcp/tools/job_details_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 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/sidekiq/mcp/tools/job_details_tool.rb', line 16 def perform(jid:) job = find_job_by_jid(jid) return "Job #{jid} not found" unless job details = { jid: job.jid, class: job.klass, args: job.args, queue: job.queue, created_at: job.created_at, enqueued_at: job.enqueued_at } # Add retry/failure specific info if job.respond_to?(:[]) details[:error_message] = job["error_message"] if job["error_message"] details[:error_class] = job["error_class"] if job["error_class"] details[:failed_at] = job["failed_at"] if job["failed_at"] details[:retry_count] = job["retry_count"] if job["retry_count"] details[:retried_at] = job["retried_at"] if job["retried_at"] details[:backtrace] = job["error_backtrace"] if job["error_backtrace"] end # Add scheduled info if job.respond_to?(:at) details[:scheduled_at] = job.at end details.to_json end |