Class: MCP::Resource

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

Defined Under Namespace

Classes: BlobContents, Contents, Embedded, TextContents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, name:, title: nil, description: nil, mime_type: nil) ⇒ Resource

Returns a new instance of Resource.



7
8
9
10
11
12
13
# File 'lib/mcp/resource.rb', line 7

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



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

def mime_type
  @mime_type
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#uriObject (readonly)

Returns the value of attribute uri.



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

def uri
  @uri
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
22
23
# File 'lib/mcp/resource.rb', line 15

def to_h
  {
    uri: uri,
    name: name,
    title: title,
    description: description,
    mimeType: mime_type,
  }.compact
end