Class: RubynCode::Tools::SendMessage
- Defined in:
- lib/rubyn_code/tools/send_message.rb
Overview
Tool for sending messages to teammates via the team mailbox.
Constant Summary collapse
- TOOL_NAME =
'send_message'- DESCRIPTION =
'Sends a message to a teammate. Used for inter-agent communication within a team.'- PARAMETERS =
{ to: { type: :string, required: true, description: 'Name of the recipient teammate' }, content: { type: :string, required: true, description: 'Message content to send' }, message_type: { type: :string, required: false, default: 'message', description: 'Type of message (default: "message")' } }.freeze
- RISK_LEVEL =
:write- REQUIRES_CONFIRMATION =
false
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute(to:, content:, message_type: 'message') ⇒ String
Sends a message to the specified teammate.
-
#initialize(project_root:, mailbox:, sender_name:) ⇒ SendMessage
constructor
A new instance of SendMessage.
Methods inherited from Base
description, parameters, requires_confirmation?, risk_level, #safe_path, summarize, to_schema, tool_name, #truncate
Constructor Details
#initialize(project_root:, mailbox:, sender_name:) ⇒ SendMessage
Returns a new instance of SendMessage.
24 25 26 27 28 |
# File 'lib/rubyn_code/tools/send_message.rb', line 24 def initialize(project_root:, mailbox:, sender_name:) super(project_root: project_root) @mailbox = mailbox @sender_name = sender_name end |
Instance Method Details
#execute(to:, content:, message_type: 'message') ⇒ String
Sends a message to the specified teammate.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubyn_code/tools/send_message.rb', line 36 def execute(to:, content:, message_type: 'message') raise Error, 'Recipient name is required' if to.nil? || to.strip.empty? raise Error, 'Message content is required' if content.nil? || content.strip.empty? = @mailbox.send( from: @sender_name, to: to, content: content, message_type: ) "Message sent to '#{to}' (id: #{}, type: #{})" end |