Class: Pgbus::MCP::Tools::QueueDetailTool

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

Overview

Per-queue detail: metrics, paused state, and table health (dead tuples, bloat, vacuum age). Maps to DataSource#queue_detail + #queue_paused? + #queue_health_detail. The name is the full physical queue name as returned by pgbus_queues (e.g. “pgbus_default”), not the logical name.

Class Method Summary collapse

Methods inherited from BaseTool

annotations_value, data_source_from, error_response, json_response, payloads_allowed?

Class Method Details

.call(name:, server_context: nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pgbus/mcp/tools/queue_detail_tool.rb', line 31

def self.call(name:, server_context: nil)
  data_source = data_source_from(server_context)
  detail = data_source.queue_detail(name)
  return error_response("Queue not found: #{name}") unless detail

  json_response(
    detail.merge(
      paused: data_source.queue_paused?(name),
      health: data_source.queue_health_detail(name)
    )
  )
end