Class: MCP::Content::Text

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, annotations: nil) ⇒ Text

Returns a new instance of Text.



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

def initialize(text, annotations: nil)
  @text = text
  @annotations = annotations
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



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

def annotations
  @annotations
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#to_hObject



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

def to_h
  { text:, annotations:, type: "text" }.compact
end