Class: ModelContextProtocol::Server::Content::Annotations

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

#audienceObject (readonly)

Returns the value of attribute audience

Returns:

  • (Object)

    the current value of audience



267
268
269
# File 'lib/model_context_protocol/server/content.rb', line 267

def audience
  @audience
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified

Returns:

  • (Object)

    the current value of last_modified



267
268
269
# File 'lib/model_context_protocol/server/content.rb', line 267

def last_modified
  @last_modified
end

#priorityObject (readonly)

Returns the value of attribute priority

Returns:

  • (Object)

    the current value of priority



267
268
269
# File 'lib/model_context_protocol/server/content.rb', line 267

def priority
  @priority
end

Instance Method Details

#serializedObject



268
269
270
271
272
273
274
275
276
277
# File 'lib/model_context_protocol/server/content.rb', line 268

def serialized
  serialized_data = {audience:, lastModified: last_modified, priority:}.compact

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

  serialized_data.empty? ? nil : serialized_data
end