Class: MCP::Tool::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mcp/tool/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, is_error = false) ⇒ Response



8
9
10
11
# File 'lib/mcp/tool/response.rb', line 8

def initialize(content, is_error = false)
  @content = content
  @is_error = is_error
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/mcp/tool/response.rb', line 6

def content
  @content
end

#is_errorObject (readonly)

Returns the value of attribute is_error.



6
7
8
# File 'lib/mcp/tool/response.rb', line 6

def is_error
  @is_error
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/mcp/tool/response.rb', line 13

def to_h
  { content:, isError: is_error }.compact
end