Class: Nanobot::Agent::Tools::ScheduleRemove

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/nanobot/agent/tools/schedule.rb

Overview

Tool for removing scheduled tasks

Instance Method Summary collapse

Constructor Details

#initialize(store:) ⇒ ScheduleRemove

Returns a new instance of ScheduleRemove.

Parameters:



78
79
80
81
# File 'lib/nanobot/agent/tools/schedule.rb', line 78

def initialize(store:)
  super()
  @store = store
end

Instance Method Details

#execute(id:) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/nanobot/agent/tools/schedule.rb', line 83

def execute(id:)
  # Support partial ID matching
  schedule = @store.get(id) || @store.list.find { |s| s.id.start_with?(id) }
  return "Schedule not found: #{id}" unless schedule

  @store.remove(schedule.id)
  "Removed schedule #{schedule.id} (#{schedule.kind}: #{schedule.expression})"
end