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 =

Returns MCP tool identifier string.

Returns:

  • (String)

    MCP tool identifier string.

'rai_doctor'
DESCRIPTION =

Returns Human-readable description of this tool.

Returns:

  • (String)

    Human-readable description of this tool.

'Run rosett-ai diagnostic checks'
ANNOTATIONS =

Returns MCP protocol annotations describing tool capabilities.

Returns:

  • (Hash)

    MCP protocol annotations describing tool capabilities.

{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze
INPUT_SCHEMA =

Returns JSON Schema defining the tool input parameters.

Returns:

  • (Hash)

    JSON Schema defining the tool input parameters.

{
  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



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/rosett_ai/mcp/tools/doctor_tool.rb', line 51

def call(check: nil, format: 'json')
  results = RosettAi::Doctor.run_all(only: check)
  failures = results.select { |r| r[:status] == 'fail' }
  {
    healthy: failures.empty?,
    checks: results,
    failures: failures,
    format: format
  }
rescue StandardError => e
  ResponseHelper.error("Doctor check failed: #{e.message}")
end