Class: ActionMCP::Content::Text
- Defined in:
- lib/action_mcp/content/text.rb
Overview
Text content represents plain text messages.
Instance Attribute Summary collapse
-
#text ⇒ String
readonly
The text content.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text, annotations: nil) ⇒ Text
constructor
Initializes a new Text content.
-
#to_h ⇒ Hash
Returns a hash representation of the text content.
Methods inherited from Base
Constructor Details
#initialize(text, annotations: nil) ⇒ Text
Initializes a new Text content.
14 15 16 17 |
# File 'lib/action_mcp/content/text.rb', line 14 def initialize(text, annotations: nil) super("text", annotations: annotations) @text = text.to_s end |
Instance Attribute Details
#text ⇒ String (readonly)
Returns The text content.
8 9 10 |
# File 'lib/action_mcp/content/text.rb', line 8 def text @text end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of the text content.
22 23 24 |
# File 'lib/action_mcp/content/text.rb', line 22 def to_h super.merge(text: @text) end |