Class: RailsAiBridge::Doctor::Checkers::ViewMcpToolChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/view_mcp_tool_checker.rb

Overview

Ensures +rails_get_view+ is registered when views and +:views+ introspection matter.

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#callDoctor::Check

Returns +:pass+, +:warn+, or +:fail+ depending on views and tool registration.

Returns:

  • (Doctor::Check)

    +:pass+, +:warn+, or +:fail+ depending on views and tool registration



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rails_ai_bridge/doctor/checkers/view_mcp_tool_checker.rb', line 9

def call
  unless view_files_present?
    return new_check(name: 'View MCP tool', status: :pass,
                     message: 'No view files detected; view MCP tool not required', fix: nil)
  end

  unless RailsAiBridge.configuration.introspectors.include?(:views)
    return new_check(
      name: 'View MCP tool',
      status: :warn,
      message: 'Views detected but :views introspector is disabled',
      fix: 'Enable it with `RailsAiBridge.configure { |c| c.introspectors |= [:views] }`'
    )
  end

  check(
    'View MCP tool',
    tool_registered?('rails_get_view'),
    pass: { message: 'rails_get_view available for view inspection' },
    fail: { status: :fail, message: 'rails_get_view is not registered', fix: 'Register `RailsAiBridge::Tools::GetView` in the MCP server' }
  )
end