Class: RosettAi::Mcp::Tools::ComplyTool

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

Overview

MCP tool: run rosett-ai compliance checks.

Executes CRA, license, and SPDX header checks. Read-only operation — does not modify any files.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_comply'
DESCRIPTION =
'Run rosett-ai compliance checks (CRA, license, SPDX headers)'
ANNOTATIONS =
{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(cra: false, license: false, headers: false, format: 'json') ⇒ Hash

Executes compliance checks.

Parameters:

  • cra (Boolean) (defaults to: false)

    run CRA checks only

  • license (Boolean) (defaults to: false)

    run license checks only

  • headers (Boolean) (defaults to: false)

    run SPDX header checks only

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

    output format ('json' or 'text')

Returns:

  • (Hash)

    compliance results



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rosett_ai/mcp/tools/comply_tool.rb', line 34

def call(cra: false, license: false, headers: false, format: 'json')
  checker = RosettAi::Compliance::Checker.new
  results = checker.check(cra: cra, license: license, headers: headers)
  {
    compliant: results[:violations].empty?,
    violations: results[:violations],
    checks_run: results[:checks_run],
    format: format
  }
rescue StandardError => e
  ResponseHelper.error("Compliance check failed: #{e.message}")
end