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
INPUT_SCHEMA =
{
  type: 'object',
  properties: {
    action: {
      type: 'string',
      enum: ['list', 'validate', 'simulate'],
      description: 'Workflow action (default: list)'
    },
    name: {
      type: 'string',
      description: 'Workflow name (required for 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



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

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