Class: Pgbus::MCP::Tools::ThroughputTool

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/pgbus/mcp/tools/throughput_tool.rb

Overview

Recent job throughput as a time series. Maps to DataSource#job_throughput. Used to answer “is the system draining?”.

Constant Summary collapse

MAX_MINUTES =
1440

Class Method Summary collapse

Methods inherited from BaseTool

annotations_value, data_source_from, error_response, json_response, payloads_allowed?

Class Method Details

.call(minutes: 60, server_context: nil) ⇒ Object



27
28
29
30
31
# File 'lib/pgbus/mcp/tools/throughput_tool.rb', line 27

def self.call(minutes: 60, server_context: nil)
  data_source = data_source_from(server_context)
  window = minutes.to_i.clamp(1, MAX_MINUTES)
  json_response({ minutes: window, throughput: data_source.job_throughput(minutes: window) })
end