Class: Manceps::Content
- Inherits:
-
Object
- Object
- Manceps::Content
- Defined in:
- lib/manceps/content.rb
Overview
A single content item returned by an MCP tool or prompt.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #image? ⇒ Boolean
-
#initialize(data) ⇒ Content
constructor
A new instance of Content.
- #resource? ⇒ Boolean
- #resource_link? ⇒ Boolean
- #text? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Content
Returns a new instance of Content.
8 9 10 11 12 13 14 15 |
# File 'lib/manceps/content.rb', line 8 def initialize(data) @type = data['type'] @text = data['text'] @data = data['data'] # base64 for image/audio @mime_type = data['mimeType'] @uri = data['uri'] # for resource content @resource = data['resource'] # for resource_link type end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def data @data end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def mime_type @mime_type end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def resource @resource end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def type @type end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/manceps/content.rb', line 6 def uri @uri end |
Instance Method Details
#image? ⇒ Boolean
21 22 23 |
# File 'lib/manceps/content.rb', line 21 def image? type == 'image' end |
#resource? ⇒ Boolean
25 26 27 |
# File 'lib/manceps/content.rb', line 25 def resource? type == 'resource' end |
#resource_link? ⇒ Boolean
29 30 31 |
# File 'lib/manceps/content.rb', line 29 def resource_link? type == 'resource_link' end |
#text? ⇒ Boolean
17 18 19 |
# File 'lib/manceps/content.rb', line 17 def text? type == 'text' end |