Class: Sidekiq::Mcp::Tools::ClearQueueTool
- Inherits:
-
Sidekiq::Mcp::Tool
- Object
- Sidekiq::Mcp::Tool
- Sidekiq::Mcp::Tools::ClearQueueTool
- Defined in:
- lib/sidekiq/mcp/tools/clear_queue_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(queue_name:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sidekiq/mcp/tools/clear_queue_tool.rb', line 16 def perform(queue_name:) queue = Sidekiq::Queue.new(queue_name) initial_size = queue.size if initial_size == 0 "Queue '#{queue_name}' is already empty" else queue.clear "Cleared #{initial_size} jobs from queue '#{queue_name}'" end end |