Class: RosettAi::Mcp::Tools::DoctorTool

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/mcp/tools/doctor_tool.rb

Overview

MCP tool: run rosett-ai diagnostics.

Executes system diagnostic checks and reports status. Read-only operation.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_doctor'
DESCRIPTION =
'Run rosett-ai diagnostic checks'
ANNOTATIONS =
{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze
INPUT_SCHEMA =
{
  type: 'object',
  properties: {
    check: {
      type: 'string',
      description: 'Run a specific diagnostic check (default: all)'
    },
    format: {
      type: 'string',
      enum: ['json', 'text'],
      description: 'Output format (default: json)'
    }
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(check: nil, format: 'json') ⇒ Hash

Executes diagnostic checks.

Parameters:

  • check (String, nil) (defaults to: nil)

    specific check to run

  • format (String) (defaults to: 'json')

    output format ('json' or 'text')

Returns:

  • (Hash)

    diagnostic results



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rosett_ai/mcp/tools/doctor_tool.rb', line 47

def call(check: nil, format: 'json')
  doctor = RosettAi::Doctor::Runner.new
  results = check ? doctor.run_check(check) : doctor.run_all
  {
    healthy: results[:failures].empty?,
    checks: results[:checks],
    failures: results[:failures],
    format: format
  }
rescue StandardError => e
  ResponseHelper.error("Doctor check failed: #{e.message}")
end