Class: RosettAi::Mcp::Tools::BackupTool

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

Overview

MCP tool: create rai backup.

Backs up global and/or local rai configuration. Write operation — creates backup archive.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =

Returns MCP tool identifier string.

Returns:

  • (String)

    MCP tool identifier string.

'rai_backup'
DESCRIPTION =

Returns Human-readable description of this tool.

Returns:

  • (String)

    Human-readable description of this tool.

'Create rai configuration backup'
ANNOTATIONS =

Returns MCP protocol annotations describing tool capabilities.

Returns:

  • (Hash)

    MCP protocol annotations describing tool capabilities.

{
  'readOnlyHint' => false,
  'destructiveHint' => false,
  'idempotentHint' => false,
  '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: {
    global: {
      type: 'boolean',
      description: 'Back up global ~/.claude/ structure (default: false)'
    },
    local: {
      type: 'boolean',
      description: 'Back up project .claude/ and CLAUDE.md (default: false)'
    },
    compression: {
      type: 'string',
      enum: ['zip', 'none'],
      description: 'Compression format (default: zip)'
    }
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(global: false, local: false, compression: 'zip') ⇒ Hash

Executes the backup.

Parameters:

  • global (Boolean) (defaults to: false)

    back up global structure

  • local (Boolean) (defaults to: false)

    back up local structure

  • compression (String) (defaults to: 'zip')

    compression format

Returns:

  • (Hash)

    backup results



56
57
58
59
60
61
62
63
64
# File 'lib/rosett_ai/mcp/tools/backup_tool.rb', line 56

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

  manager = RosettAi::Backup::Manager.new
  result = manager.create(global: global, local: local, compression: compression)
  ResponseHelper.success('Backup created', path: result[:path], size: result[:size])
rescue StandardError => e
  ResponseHelper.error("Backup failed: #{e.message}")
end