Class: RosettAi::Mcp::Tools::CompileStatusTool

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

Overview

MCP tool: show compilation staleness status.

Compares source behaviour/design YAML files against their compiled output, reporting per-file checksums and staleness. Read-only.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =

Returns MCP tool identifier string.

Returns:

  • (String)

    MCP tool identifier string.

'rai_compile_status'
DESCRIPTION =

Returns Human-readable description of this tool.

Returns:

  • (String)

    Human-readable description of this tool.

'Show compiled rules staleness — source vs compiled checksums'
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: {
    scope: {
      type: 'string',
      description: 'Scope to check staleness for (default: all)'
    }
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(scope: nil) ⇒ Hash

Checks staleness of compiled output files.

Parameters:

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

    optional filter ('behaviour', 'design')

Returns:

  • (Hash)

    per-file staleness report



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/rosett_ai/mcp/tools/compile_status_tool.rb', line 48

def call(scope: nil)
  compiled_dir = RosettAi.paths.rules_dir
  source_dir = resolve_source_dir

  files = collect_source_files(source_dir, scope)
  report = files.map { |src| build_file_report(src, compiled_dir) }

  stale_count = report.count { |r| r[:stale] }
  {
    files: report,
    total: report.size,
    stale: stale_count,
    up_to_date: report.size - stale_count,
    compiled_dir: compiled_dir.to_s,
    source_dir: source_dir.to_s
  }
rescue StandardError => e
  ResponseHelper.error("Compile status failed: #{e.message}")
end