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.



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

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.



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

def annotations
  @annotations
end

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



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

def mime_type
  @mime_type
end

Instance Method Details

#to_hObject



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

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