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
INPUT_SCHEMA =
{
  type: 'object',
  properties: {
    action: {
      type: 'string',
      enum: ['list', 'install', 'update'],
      description: 'Content action (default: list)'
    },
    pack_name: {
      type: 'string',
      description: 'Content pack name (required for install)'
    }
  }
}.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



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rosett_ai/mcp/tools/content_tool.rb', line 49

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

  case action
  when 'list' then action_list
  when 'install' then action_install(pack_name)
  when 'update' then ResponseHelper.error('Content update requires CLI: raictl content update')
  end
rescue StandardError => e
  ResponseHelper.error("Content #{action} failed: #{e.message}")
end