Module: OmnifocusMcp::Tools::Presenters::ListPerspectives

Defined in:
lib/omnifocus_mcp/tools/presenters/list_perspectives.rb

Class Method Summary collapse

Class Method Details

.format(perspectives) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/omnifocus_mcp/tools/presenters/list_perspectives.rb', line 8

def format(perspectives)
  return "No perspectives found." if perspectives.empty?

  built_in = perspectives.select { |perspective| perspective["type"] == "builtin" }
  custom = perspectives.select { |perspective| perspective["type"] == "custom" }

  output = "## Available Perspectives (#{perspectives.length})\n\n"
  append_group(output:, title: "Built-in Perspectives", perspectives: built_in)
  output << "\n" if built_in.any? && custom.any?
  append_group(output:, title: "Custom Perspectives", perspectives: custom)
  output
end