Class: ActionMCP::Content::Image
- Defined in:
- lib/action_mcp/content/image.rb
Overview
Image content includes a base64-encoded image and its MIME type.
Instance Attribute Summary collapse
- #data ⇒ String readonly
- #mime_type ⇒ String readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(data, mime_type, annotations: nil) ⇒ Image
constructor
Initializes a new Image content.
-
#to_h ⇒ Hash
Returns a hash representation of the image content.
Methods inherited from Base
Constructor Details
#initialize(data, mime_type, annotations: nil) ⇒ Image
Initializes a new Image content.
16 17 18 19 20 |
# File 'lib/action_mcp/content/image.rb', line 16 def initialize(data, mime_type, annotations: nil) super("image", annotations: annotations) @data = data @mime_type = mime_type end |
Instance Attribute Details
#data ⇒ String (readonly)
9 10 11 |
# File 'lib/action_mcp/content/image.rb', line 9 def data @data end |
#mime_type ⇒ String (readonly)
9 10 11 |
# File 'lib/action_mcp/content/image.rb', line 9 def mime_type @mime_type end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of the image content.
25 26 27 |
# File 'lib/action_mcp/content/image.rb', line 25 def to_h super.merge(data: @data, mimeType: @mime_type) end |