createRegistryRecord method

Future<CreateRegistryRecordResponse> createRegistryRecord({
  1. required Descriptors descriptors,
  2. required String name,
  3. required RecordType recordType,
  4. required String registryId,
  5. String? clientToken,
  6. String? description,
  7. String? displayName,
  8. String? recordVersion,
  9. Map<String, String>? tags,
})

Creates a registry record within a registry. A registry record describes a discoverable resource, such as an MCP server, an agent, an agent skill, or a custom resource. Creation is asynchronous: the record is returned with the CREATING status while it is processed.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter descriptors : The typed descriptor content for the registry record

Parameter name : The name of the registry record

Parameter recordType : The type of the registry record, which determines the descriptor format

Parameter registryId : The identifier of the registry in which to create the record (ARN or ID)

Parameter clientToken : Client token for idempotency

Parameter description : The description of the registry record

Parameter displayName : The human-readable display name of the registry record

Parameter recordVersion : The version of the registry record

Parameter tags : Tags to associate with the registry record

Implementation

Future<CreateRegistryRecordResponse> createRegistryRecord({
  required Descriptors descriptors,
  required String name,
  required RecordType recordType,
  required String registryId,
  String? clientToken,
  String? description,
  String? displayName,
  String? recordVersion,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'descriptors': descriptors,
    'name': name,
    'recordType': recordType.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (displayName != null) 'displayName': displayName,
    if (recordVersion != null) 'recordVersion': recordVersion,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/registries/${Uri.encodeComponent(registryId)}/records',
    exceptionFnMap: _exceptionFns,
  );
  return CreateRegistryRecordResponse.fromJson(response);
}