Class: OmnifocusMcp::Tools::Definitions::ListPerspectivesTool

Inherits:
FastMcp::Tool
  • Object
show all
Extended by:
OperationFactory
Defined in:
lib/omnifocus_mcp/tools/definitions/list_perspectives_tool.rb

Overview

‘FastMcp::Tool` for `list_perspectives`.

Instance Method Summary collapse

Methods included from OperationFactory

default_operation_factory, extended, operation_factory, operation_factory=

Instance Method Details

#call(**args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/omnifocus_mcp/tools/definitions/list_perspectives_tool.rb', line 32

def call(**args)
  McpEnvelope.safely("listing perspectives") do
    params = Params::ListPerspectivesParams.from_mcp(args)

    operation.call(params).fold(
      on_ok: lambda { |perspectives|
        McpEnvelope::ToolReply.success(Presenters::ListPerspectives.format(perspectives))
      },
      on_error: ->(err) { McpEnvelope::ToolReply.failure(Messages::ListTools.list_perspectives_failure(err)) }
    )
  end
end