Class: TalkToYourApp::Plugins::Jobs::Tools::FailedJobs

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

Overview

Returns recently failed jobs with their error messages, capped at 500.

Constant Summary collapse

MAX_LIMIT =
500

Instance Method Summary collapse

Methods inherited from Tool

argument, arguments, connection, default_arguments, description, dispatch, input_schema_hash, invoke, name, normalize_response, to_mcp_definition, to_mcp_tool

Instance Method Details

#call(args, _ctx) ⇒ Object



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

def call(args, _ctx)
  limit = args[:limit].to_i.clamp(1, MAX_LIMIT)
  json(TalkToYourApp::Plugins::Jobs.configured_adapter.failed_jobs(limit: limit))
rescue StandardError => e
  error("Jobs backend unavailable: #{e.class}: #{e.message}")
end