Class: TrakFlow::Mcp::Tools::PlanAddStep

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/trak_flow/mcp/tools/plan_add_step.rb

Instance Method Summary collapse

Methods inherited from BaseTool

with_database

Instance Method Details

#call(plan_id:, title:, description: nil, type: "task", priority: 2) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/trak_flow/mcp/tools/plan_add_step.rb', line 18

def call(plan_id:, title:, description: nil, type: "task", priority: 2)
  self.class.with_database do |db|
    plan = db.find_task!(plan_id)
    raise TrakFlow::Error, "#{plan_id} is not a Plan" unless plan.plan?

    task = db.create_child_task(plan_id, {
      title: title,
      description: description || "",
      type: type,
      priority: priority
    })
    task.to_h
  end
end