Class: MCP::Resource::TextContents

Inherits:
Contents
  • Object
show all
Defined in:
lib/mcp/resource/contents.rb

Instance Attribute Summary collapse

Attributes inherited from Contents

#mime_type, #uri

Instance Method Summary collapse

Constructor Details

#initialize(text:, uri:, mime_type:) ⇒ TextContents

Returns a new instance of TextContents.



21
22
23
24
# File 'lib/mcp/resource/contents.rb', line 21

def initialize(text:, uri:, mime_type:)
  super(uri: uri, mime_type: mime_type)
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



19
20
21
# File 'lib/mcp/resource/contents.rb', line 19

def text
  @text
end

Instance Method Details

#to_hObject



26
27
28
# File 'lib/mcp/resource/contents.rb', line 26

def to_h
  super.merge(text: text)
end