Class: RosettAi::Mcp::Tools::ComplyTool
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Tools::ComplyTool
- 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.
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
- INPUT_SCHEMA =
{ type: 'object', properties: { cra: { type: 'boolean', description: 'Run CRA-specific checks only (default: false)' }, license: { type: 'boolean', description: 'Run license audit checks only (default: false)' }, headers: { type: 'boolean', description: 'Run SPDX header checks only (default: false)' }, format: { type: 'string', enum: ['json', 'text'], description: 'Output format (default: json)' } } }.freeze
Instance Method Summary collapse
-
#call(cra: false, license: false, headers: false, format: 'json') ⇒ Hash
Executes compliance checks.
Instance Method Details
#call(cra: false, license: false, headers: false, format: 'json') ⇒ Hash
Executes compliance checks.
57 58 59 60 61 62 63 64 |
# File 'lib/rosett_ai/mcp/tools/comply_tool.rb', line 57 def call(cra: false, license: false, headers: false, format: 'json') checks = filter_checks(cra: cra, license: license, headers: headers) results = run_checks(checks) violations = results.select { |r| r[:status] == 'fail' } { compliant: violations.empty?, results: results, violations: violations, format: format } rescue StandardError => e ResponseHelper.error("Compliance check failed: #{e.}") end |