Class: HTM::MCP::PromoteRobotTool

Inherits:
FastMcp::Tool
  • Object
show all
Defined in:
lib/htm/mcp/group_tools.rb

Overview

Tool: Promote a passive robot to active

Instance Method Summary collapse

Instance Method Details

#call(group_name:, robot_name:) ⇒ Object



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/htm/mcp/group_tools.rb', line 307

def call(group_name:, robot_name:)
  Session.logger&.info "PromoteRobotTool called: group=#{group_name.inspect}, robot=#{robot_name.inspect}"

  group = GroupSession.get_group(group_name)
  unless group
    return { success: false, error: "Group '#{group_name}' not found in this session" }.to_json
  end

  group.promote(robot_name)

  Session.logger&.info "Robot #{robot_name} promoted to active in group #{group_name}"

  {
    success:    true,
    group_name: group_name,
    robot_name: robot_name,
    message:    "Robot '#{robot_name}' promoted to active"
  }.to_json
rescue ArgumentError => e
  { success: false, error: e.message }.to_json
end