Class: Iron::Mcp::Tools::Base

Inherits:
MCP::Tool
  • Object
show all
Defined in:
app/mcp/iron/mcp/tools/base.rb

Class Method Summary collapse

Class Method Details

.call(server_context:, **arguments) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/mcp/iron/mcp/tools/base.rb', line 6

def call(server_context:, **arguments)
  structured = perform(context(server_context), **arguments)
  success(structured)
rescue Iron::Mcp::Error, Iron::Content::Error, ActiveRecord::RecordNotFound => error
  failure(error)
rescue => error
  Rails.error.report(error, handled: true, source: "iron.mcp")
  internal_failure
end

.perform(_context, **_arguments) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'app/mcp/iron/mcp/tools/base.rb', line 16

def perform(_context, **_arguments)
  raise NotImplementedError, "#{name} must implement .perform"
end