Class: ModelContextProtocol::Server::Content::ResourceLink

Inherits:
Data
  • Object
show all
Defined in:
lib/model_context_protocol/server/content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations

Returns:

  • (Object)

    the current value of annotations



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def annotations
  @annotations
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def description
  @description
end

#metaObject (readonly)

Returns the value of attribute meta

Returns:

  • (Object)

    the current value of meta



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def meta
  @meta
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type

Returns:

  • (Object)

    the current value of mime_type



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def mime_type
  @mime_type
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size

Returns:

  • (Object)

    the current value of size



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def size
  @size
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def title
  @title
end

#uriObject (readonly)

Returns the value of attribute uri

Returns:

  • (Object)

    the current value of uri



196
197
198
# File 'lib/model_context_protocol/server/content.rb', line 196

def uri
  @uri
end

Instance Method Details

#serializedObject



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/model_context_protocol/server/content.rb', line 197

def serialized
  serialized_data = {
    _meta: meta,
    annotations:,
    description:,
    mimeType: mime_type,
    name:,
    size:,
    title:,
    type: "resource_link",
    uri:
  }.compact

  validation_errors = JSON::Validator.fully_validate(schema, serialized_data)
  if validation_errors.empty?
    serialized_data
  else
    raise ContentValidationError, validation_errors.join(", ")
  end
end