Class: MCP::Content::Image

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, mime_type, annotations: nil) ⇒ Image

Returns a new instance of Image.



22
23
24
25
26
# File 'lib/mcp/content.rb', line 22

def initialize(data, mime_type, annotations: nil)
  @data = data
  @mime_type = mime_type
  @annotations = annotations
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



20
21
22
# File 'lib/mcp/content.rb', line 20

def annotations
  @annotations
end

#dataObject (readonly)

Returns the value of attribute data.



20
21
22
# File 'lib/mcp/content.rb', line 20

def data
  @data
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



20
21
22
# File 'lib/mcp/content.rb', line 20

def mime_type
  @mime_type
end

Instance Method Details

#to_hObject



28
29
30
# File 'lib/mcp/content.rb', line 28

def to_h
  { data:, mime_type:, annotations:, type: "image" }.compact
end