Class: SwarmSDK::Tools::Clock

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/swarm_sdk/tools/clock.rb

Overview

Clock tool provides current date and time information

Returns current temporal information in a consistent format. Agents use this when they need to know what day/time it is.

Instance Method Summary collapse

Instance Method Details

#executeObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/swarm_sdk/tools/clock.rb', line 32

def execute
  now = Time.now

  <<~RESULT.chomp
    Current date: #{now.strftime("%Y-%m-%d")}
    Current time: #{now.strftime("%H:%M:%S")}
    Day of week: #{now.strftime("%A")}
    ISO 8601: #{now.iso8601}
  RESULT
end

#nameObject

Override name to return simple "Clock"



28
29
30
# File 'lib/swarm_sdk/tools/clock.rb', line 28

def name
  "Clock"
end