Class: MCP::Resource::Contents

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

Direct Known Subclasses

BlobContents, TextContents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, mime_type: nil) ⇒ Contents

Returns a new instance of Contents.



8
9
10
11
# File 'lib/mcp/resource/contents.rb', line 8

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

Instance Attribute Details

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



6
7
8
# File 'lib/mcp/resource/contents.rb', line 6

def mime_type
  @mime_type
end

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/mcp/resource/contents.rb', line 6

def uri
  @uri
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/mcp/resource/contents.rb', line 13

def to_h
  { uri:, mime_type: }.compact
end