Class: TalkToYourApp::Plugins::Jobs::Tools::RateMetrics

Inherits:
Base
  • Object
show all
Defined in:
lib/talk_to_your_app/plugins/jobs/tools/rate_metrics.rb

Overview

Processed/failed/enqueued counts over a trailing window. The window is expressed in seconds (default 30 minutes); adapters that cannot honor sub-day granularity say so in the response note.

Constant Summary collapse

DEFAULT_WINDOW_SECONDS =
1800

Instance Method Summary collapse

Methods inherited from Tool

argument, arguments, clear_custom_registry!, connection, custom_registry, default_arguments, description, dispatch, inherited, input_schema_hash, invoke, name, normalize_response, to_mcp_definition, to_mcp_tool, tool_name

Instance Method Details

#call(args, _ctx) ⇒ Object



19
20
21
22
23
24
# File 'lib/talk_to_your_app/plugins/jobs/tools/rate_metrics.rb', line 19

def call(args, _ctx)
  window = args[:window] || DEFAULT_WINDOW_SECONDS
  json(adapter.rate_metrics(window: window))
rescue StandardError => e
  error("Jobs backend unavailable: #{e.class}: #{e.message}")
end