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 =

Returns MCP tool identifier string.

Returns:

  • (String)

    MCP tool identifier string.

'rai_content'
DESCRIPTION =

Returns Human-readable description of this tool.

Returns:

  • (String)

    Human-readable description of this tool.

'List, install, or update rai content packs'
ANNOTATIONS =

Returns MCP protocol annotations describing tool capabilities.

Returns:

  • (Hash)

    MCP protocol annotations describing tool capabilities.

{
  'readOnlyHint' => false,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => true
}.freeze
VALID_ACTIONS =

Returns Set of permitted action values.

Returns:

  • (Array)

    Set of permitted action values.

['list', 'install', 'update'].freeze
INPUT_SCHEMA =

Returns JSON Schema defining the tool input parameters.

Returns:

  • (Hash)

    JSON Schema defining the tool input parameters.

{
  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



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

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