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



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

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.



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

def text
  @text
end

Instance Method Details

#to_hObject



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

def to_h
  super.merge(text: text)
end