Class: McpServer::ListProjectsTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/jirametrics/mcp_server.rb

Class Method Summary collapse

Class Method Details

.call(server_context:) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/jirametrics/mcp_server.rb', line 173

def self.call(server_context:, **)
  lines = server_context[:projects].map do |project_name, project_data|
    "#{project_name} | #{project_data[:issues].size} issues | Data through: #{project_data[:today]}"
  end

  aggregates = server_context[:aggregates] || {}
  unless aggregates.empty?
    lines << ''
    lines << 'Aggregate groups (can be used as a project filter):'
    aggregates.each do |name, constituent_names|
      lines << "#{name} | includes: #{constituent_names.join(', ')}"
    end
  end

  MCP::Tool::Response.new([{ type: 'text', text: lines.join("\n") }])
end