Class: TrakFlow::Mcp::Resources::PlanById

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/trak_flow/mcp/resources/plan_by_id.rb

Instance Method Summary collapse

Methods inherited from BaseResource

with_database

Instance Method Details

#contentObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trak_flow/mcp/resources/plan_by_id.rb', line 12

def content
  self.class.with_database do |db|
    plan = db.find_task!(params[:id])
    steps = db.find_plan_tasks(plan.id)

    result = {
      plan: plan.to_h,
      steps: steps.map(&:to_h)
    }
    Oj.dump(result, mode: :compat, indent: 2)
  end
end