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.



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

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

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



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

def annotations
  @annotations
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#to_hObject



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

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