Method: MCP::Tool::Response#initialize

Defined in:
lib/mcp/tool/response.rb

#initialize(content = nil, deprecated_error = NOT_GIVEN, error: false, structured_content: nil) ⇒ Response

Returns a new instance of Response.



10
11
12
13
14
15
16
17
18
19
# File 'lib/mcp/tool/response.rb', line 10

def initialize(content = nil, deprecated_error = NOT_GIVEN, error: false, structured_content: nil)
  if deprecated_error != NOT_GIVEN
    warn("Passing `error` with the 2nd argument of `Response.new` is deprecated. Use keyword argument like `Response.new(content, error: error)` instead.", uplevel: 1)
    error = deprecated_error
  end

  @content = content || []
  @error = error
  @structured_content = structured_content
end