Class: RosettAi::Mcp::Tools::RetrofitTool
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Tools::RetrofitTool
- Defined in:
- lib/rosett_ai/mcp/tools/retrofit_tool.rb
Overview
MCP tool: retrofit native configurations.
Scan and convert native AI tool configs to Rosett-AI YAML. Write operation for convert action.
Constant Summary collapse
- TOOL_NAME =
'rai_retrofit'- DESCRIPTION =
'Scan and convert native AI configs to rosett-ai format'- ANNOTATIONS =
{ 'readOnlyHint' => false, 'destructiveHint' => false, 'idempotentHint' => true, 'openWorldHint' => false }.freeze
- VALID_ACTIONS =
['engines', 'scan', 'convert'].freeze
- INPUT_SCHEMA =
{ type: 'object', properties: { action: { type: 'string', enum: ['engines', 'scan', 'convert'], description: 'Retrofit action (default: scan)' }, engine: { type: 'string', description: 'Engine to retrofit from' }, simulate: { type: 'boolean', description: 'Dry-run mode (default: true)' } } }.freeze
Instance Method Summary collapse
-
#call(action: 'scan', engine: nil, simulate: true) ⇒ Hash
Executes the retrofit operation.
Instance Method Details
#call(action: 'scan', engine: nil, simulate: true) ⇒ Hash
Executes the retrofit operation.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rosett_ai/mcp/tools/retrofit_tool.rb', line 54 def call(action: 'scan', engine: nil, simulate: true) return ResponseHelper.error("Invalid action: #{action}") unless VALID_ACTIONS.include?(action) retrofitter = RosettAi::Retrofit::Scanner.new case action when 'engines' then { parsers: retrofitter.available_parsers } when 'scan' then { findings: retrofitter.scan } when 'convert' then action_convert(retrofitter, engine, simulate) end rescue StandardError => e ResponseHelper.error("Retrofit #{action} failed: #{e.}") end |