Class: RubyLLM::MCP::Content
- Inherits:
-
Content
- Object
- Content
- RubyLLM::MCP::Content
- Defined in:
- lib/ruby_llm/mcp/content.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text: nil, attachments: nil) ⇒ Content
constructor
rubocop:disable Lint/MissingSuper.
-
#to_s ⇒ Object
This is a workaround to allow the content object to be passed as the tool call to return audio or image attachments.
Constructor Details
#initialize(text: nil, attachments: nil) ⇒ Content
rubocop:disable Lint/MissingSuper
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_llm/mcp/content.rb', line 8 def initialize(text: nil, attachments: nil) # rubocop:disable Lint/MissingSuper @text = text @attachments = [] # Handle MCP::Attachment objects directly without processing if .is_a?(Array) && .all? { |a| a.is_a?(MCP::Attachment) } @attachments = elsif # Let parent class process other types of attachments () end end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
6 7 8 |
# File 'lib/ruby_llm/mcp/content.rb', line 6 def @attachments end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
6 7 8 |
# File 'lib/ruby_llm/mcp/content.rb', line 6 def content @content end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/ruby_llm/mcp/content.rb', line 6 def text @text end |
Instance Method Details
#to_s ⇒ Object
This is a workaround to allow the content object to be passed as the tool call to return audio or image attachments.
23 24 25 |
# File 'lib/ruby_llm/mcp/content.rb', line 23 def to_s text.to_s end |