Class: SimpleCovMcp::Tools::HelpTool

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/simplecov_mcp/tools/help_tool.rb

Constant Summary collapse

TOOL_GUIDE =
[
  {
    tool: CoverageSummaryTool,
    label: 'Single-file coverage summary',
    use_when: 'User wants covered/total line counts or percentage for one file.',
    avoid_when: 'User needs repo-wide stats or specific uncovered lines.',
    inputs: ['path (required)', 'root/resultset/staleness (optional)']
  },
  {
    tool: UncoveredLinesTool,
    label: 'Uncovered line numbers',
    use_when: 'User asks which lines in a file still lack tests.',
    avoid_when: 'User only wants overall percentages or detailed per-line hit data.',
    inputs: ['path (required)', 'root/resultset/staleness (optional)']
  },
  {
    tool: CoverageDetailedTool,
    label: 'Per-line coverage details',
    use_when: 'User needs per-line hit counts for a file.',
    avoid_when: 'User only wants totals or uncovered line numbers.',
    inputs: ['path (required)', 'root/resultset/staleness (optional)']
  },
  {
    tool: CoverageRawTool,
    label: 'Raw SimpleCov lines array',
    use_when: 'User needs the raw SimpleCov `lines` array for a file.',
    avoid_when: 'User expects human-friendly summaries or explanations.',
    inputs: ['path (required)', 'root/resultset/staleness (optional)']
  },
  {
    tool: AllFilesCoverageTool,
    label: 'Repo-wide file coverage',
    use_when: 'User wants coverage percentages for every tracked file.',
    avoid_when: 'User asks about a single file.',
    inputs: ['root/resultset (optional)', 'sort_order', 'staleness', 'tracked_globs']
  },
  {
    tool: CoverageTotalsTool,
    label: 'Project coverage totals',
    use_when: 'User wants total/covered/uncovered line counts or the average percent.',
    avoid_when: 'User needs per-file breakdowns.',
    inputs: ['root/resultset (optional)', 'staleness', 'tracked_globs']
  },
  {
    tool: CoverageTableTool,
    label: 'Formatted coverage table',
    use_when: 'User wants the plain-text table produced by the CLI.',
    avoid_when: 'User needs JSON data for automation.',
    inputs: ['root/resultset (optional)', 'sort_order', 'staleness']
  },
  {
    tool: ValidateTool,
    label: 'Validate coverage policy',
    use_when: 'User needs to enforce coverage rules (e.g., minimum percentage) in CI.',
    avoid_when: 'User just wants to view coverage data.',
    inputs: ['path (required)', 'root/resultset (optional)']
  },
  {
    tool: ValidateTool,
    label: 'Validate coverage policy',
    use_when: 'User needs to enforce coverage rules (e.g., minimum percentage) in CI.',
    avoid_when: 'User just wants to view coverage data.',
    inputs: ['path (required)', 'root/resultset (optional)']
  },
  {
    tool: VersionTool,
    label: 'simplecov-mcp version',
    use_when: 'User needs to confirm the running gem version.',
    avoid_when: 'User is asking for coverage information.',
    inputs: ['(no arguments)']
  }
].freeze

Constants inherited from BaseTool

BaseTool::COMMON_PROPERTIES, BaseTool::ERROR_MODE_PROPERTY, BaseTool::FILE_INPUT_SCHEMA, BaseTool::PATH_PROPERTY, BaseTool::TRACKED_GLOBS_PROPERTY

Class Method Summary collapse

Methods inherited from BaseTool

coverage_schema, handle_mcp_error, input_schema_def, respond_json, with_error_handling

Class Method Details

.call(error_mode: 'log', server_context:, **_unused) ⇒ Object



94
95
96
97
98
99
100
101
# File 'lib/simplecov_mcp/tools/help_tool.rb', line 94

def call(error_mode: 'log', server_context:, **_unused)
  with_error_handling('HelpTool', error_mode: error_mode) do
    entries = TOOL_GUIDE.map { |guide| format_entry(guide) }

    data = { tools: entries }
    respond_json(data, name: 'tools_help.json')
  end
end