Class: ModelContextProtocol::Server::Content::Audio

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



104
105
106
# File 'lib/model_context_protocol/server/content.rb', line 104

def annotations
  @annotations
end

#dataObject (readonly)

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



104
105
106
# File 'lib/model_context_protocol/server/content.rb', line 104

def data
  @data
end

#metaObject (readonly)

Returns the value of attribute meta

Returns:

  • (Object)

    the current value of meta



104
105
106
# File 'lib/model_context_protocol/server/content.rb', line 104

def meta
  @meta
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type

Returns:

  • (Object)

    the current value of mime_type



104
105
106
# File 'lib/model_context_protocol/server/content.rb', line 104

def mime_type
  @mime_type
end

Instance Method Details

#serializedObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/model_context_protocol/server/content.rb', line 105

def serialized
  serialized_data = {
    _meta: meta,
    annotations:,
    data:,
    mimeType: mime_type,
    type: "audio"
  }.compact

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