Class: RosettAi::Mcp::Tools::InitTool

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

Overview

MCP tool: initialize rosett-ai structure.

Sets up global, local, or project directory structure. Write operation — creates directories and files.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_init'
DESCRIPTION =
'Initialize rosett-ai directory structure (global, local, or project)'
ANNOTATIONS =
{
  'readOnlyHint' => false,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(global: false, local: false, project: false) ⇒ Hash

Executes the initialization.

Parameters:

  • global (Boolean) (defaults to: false)

    set up global structure

  • local (Boolean) (defaults to: false)

    set up project-local structure

  • project (Boolean) (defaults to: false)

    set up .rosett-ai/ project structure

Returns:

  • (Hash)

    initialization results



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

def call(global: false, local: false, project: false)
  unless global || local || project
    return ResponseHelper.error('At least one scope required: global, local, or project')
  end

  results = { scopes: [], created: [] }
  init_global(results) if global
  init_local(results) if local
  init_project(results) if project
  ResponseHelper.success('Initialization complete', results)
rescue StandardError => e
  ResponseHelper.error("Init failed: #{e.message}")
end