Class: Roast::Cogs::Agent::Providers::Pi::Messages::ToolCallMessage
- Inherits:
-
Object
- Object
- Roast::Cogs::Agent::Providers::Pi::Messages::ToolCallMessage
- Defined in:
- lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb
Overview
Represents a tool call made by the Pi agent
In Pi’s JSON protocol, tool calls appear as ‘toolcall_end` events within `message_update` messages, containing the tool name, id, and arguments.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
: Hash[Symbol, untyped].
-
#id ⇒ Object
readonly
: String?.
-
#name ⇒ Object
readonly
: String?.
Instance Method Summary collapse
-
#format ⇒ Object
: () -> String?.
-
#initialize(id:, name:, arguments:) ⇒ ToolCallMessage
constructor
: (id: String?, name: String?, arguments: Hash[Symbol, untyped]) -> void.
Constructor Details
#initialize(id:, name:, arguments:) ⇒ ToolCallMessage
: (id: String?, name: String?, arguments: Hash[Symbol, untyped]) -> void
25 26 27 28 29 |
# File 'lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb', line 25 def initialize(id:, name:, arguments:) @id = id @name = name @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
: Hash[Symbol, untyped]
22 23 24 |
# File 'lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb', line 22 def arguments @arguments end |
#id ⇒ Object (readonly)
: String?
16 17 18 |
# File 'lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb', line 16 def id @id end |
#name ⇒ Object (readonly)
: String?
19 20 21 |
# File 'lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb', line 19 def name @name end |
Instance Method Details
#format ⇒ Object
: () -> String?
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb', line 32 def format return unless name case name.to_s.downcase when "bash" "BASH #{arguments[:command]}" when "read" "READ #{arguments[:path]}" when "edit" "EDIT #{arguments[:path]}" when "write" "WRITE #{arguments[:path]}" when "grep" "GREP #{arguments[:pattern]} #{arguments[:path]}" when "find" "FIND #{arguments[:pattern]} #{arguments[:path]}" when "ls" "LS #{arguments[:path]}" else "TOOL [#{name}] #{arguments.inspect}" end end |