Class: HTM::MCP::ListGroupsTool

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

Overview

Tool: List all robot groups

Instance Method Summary collapse

Instance Method Details

#callObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/htm/mcp/group_tools.rb', line 89

def call
  Session.logger&.info "ListGroupsTool called"

  groups = GroupSession.group_names.map do |name|
    group = GroupSession.get_group(name)
    status = group.status
    {
      name:            name,
      active_robots:   status[:active],
      passive_robots:  status[:passive],
      total_members:   status[:total_members],
      in_sync:         status[:in_sync],
      token_utilization: status[:token_utilization]
    }
  end

  Session.logger&.info "ListGroupsTool complete: #{groups.length} groups"

  {
    success: true,
    count:   groups.length,
    groups:  groups
  }.to_json
end