Class: MCP::Resource::BlobContents

Inherits:
Contents
  • Object
show all
Defined in:
lib/mcp/resource/contents.rb

Instance Attribute Summary collapse

Attributes inherited from Contents

#meta, #mime_type, #uri

Instance Method Summary collapse

Constructor Details

#initialize(data:, uri:, mime_type:, meta: nil) ⇒ BlobContents

Returns a new instance of BlobContents.



35
36
37
38
# File 'lib/mcp/resource/contents.rb', line 35

def initialize(data:, uri:, mime_type:, meta: nil)
  super(uri: uri, mime_type: mime_type, meta: meta)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



33
34
35
# File 'lib/mcp/resource/contents.rb', line 33

def data
  @data
end

Instance Method Details

#to_hObject



40
41
42
# File 'lib/mcp/resource/contents.rb', line 40

def to_h
  super.merge(blob: data)
end