Class: RosettAi::Mcp::Tools::WorkflowTool

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

Overview

MCP tool: query workflow definitions.

Lists, validates, and simulates declarative workflows. Read-only operation.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_workflow'
DESCRIPTION =
'List, validate, or simulate rai workflows'
ANNOTATIONS =
{
  'readOnlyHint' => true,
  'destructiveHint' => false,
  'idempotentHint' => true,
  'openWorldHint' => false
}.freeze
VALID_ACTIONS =
['list', 'validate', 'simulate'].freeze

Instance Method Summary collapse

Instance Method Details

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

Executes the workflow query.

Parameters:

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

    one of 'list', 'validate', 'simulate'

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

    workflow name (for validate/simulate)

Returns:

  • (Hash)

    workflow information



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

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

  manager = RosettAi::Workflow::Manager.new
  case action
  when 'list' then { workflows: manager.list }
  when 'validate' then action_validate(manager, name)
  when 'simulate' then action_simulate(manager, name)
  end
rescue StandardError => e
  ResponseHelper.error("Workflow #{action} failed: #{e.message}")
end