ResourceContents.toMCP constructor

ResourceContents.toMCP(
  1. Map<String, Object?> map
)

Implementation

factory ResourceContents.toMCP(Map<String, Object?> map) {
  if (map['text'] != null) {
    return TextResourceContents.toMCP(map);
  } else if (map['blob'] != null) {
    return BlobResourceContents.toMCP(map);
  }
  return ResourceContents(
    uri: map['uri'] as String,
    mimeType: map['mimeType'] as String?,
    $meta: map['_meta'] != null
        ? MetaObject.toMCP(map['_meta'] as Map<String, Object?>)
        : null,
  );
}