Class: RosettAi::Mcp::Tools::ContentTool

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

Overview

MCP tool: manage content packs.

List, install, or update content packs. Write operation for install/update actions.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_content'
DESCRIPTION =
'List, install, or update rai content packs'
ANNOTATIONS =
{
  'readOnlyHint' => false,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => true
}.freeze
VALID_ACTIONS =
['list', 'install', 'update'].freeze

Instance Method Summary collapse

Instance Method Details

#call(action: 'list', pack_name: nil) ⇒ Hash

Executes the content pack operation.

Parameters:

  • action (String) (defaults to: 'list')

    one of 'list', 'install', 'update'

  • pack_name (String, nil) (defaults to: nil)

    pack name for install

Returns:

  • (Hash)

    operation result



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

def call(action: 'list', pack_name: nil)
  return ResponseHelper.error("Invalid action: #{action}") unless VALID_ACTIONS.include?(action)

  manager = RosettAi::ContentPacks::Manager.new
  case action
  when 'list' then { packs: manager.list }
  when 'install' then action_install(manager, pack_name)
  when 'update' then action_update(manager)
  end
rescue StandardError => e
  ResponseHelper.error("Content #{action} failed: #{e.message}")
end