Class: RosettAi::Mcp::Tools::WorkflowExecuteTool

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

Overview

MCP tool: execute a named workflow.

Runs a declarative workflow by name. Write operation — executes workflow steps.

Author:

  • hugo

  • claude

Constant Summary collapse

TOOL_NAME =
'rai_workflow_execute'
DESCRIPTION =
'Execute a named rai workflow'
ANNOTATIONS =
{
  'readOnlyHint' => false,
  'destructiveHint' => false,
  'idempotentHint' => false,
  'openWorldHint' => false
}.freeze
INPUT_SCHEMA =
{
  type: 'object',
  properties: {
    name: {
      type: 'string',
      description: 'Workflow name to execute'
    },
    resume: {
      type: 'boolean',
      description: 'Resume a previously interrupted workflow (default: false)'
    }
  },
  required: ['name']
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(name:, resume: false) ⇒ Hash

Executes the named workflow.

Parameters:

  • name (String)

    workflow name

  • resume (Boolean) (defaults to: false)

    resume a previously interrupted workflow

Returns:

  • (Hash)

    execution results



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rosett_ai/mcp/tools/workflow_execute_tool.rb', line 47

def call(name:, resume: false)
  return ResponseHelper.error('Workflow name is required') if name.nil? || name.empty?

  path = resolve_workflow(name)
  return ResponseHelper.error("Workflow '#{name}' not found") unless path

  engine = RosettAi::Workflow::Engine.new(workflow_path: path)
  build_result(name, engine.execute(resume: resume))
rescue StandardError => e
  ResponseHelper.error("Workflow execute failed: #{e.message}")
end