There are some limitations like In the current release, we support only two metadata types: page layouts and the records of custom metadata types. Reading, creating, and updating metadata are supported, but deleting metadata is not supported.
Although there’s a lot you can do with Apex Metadata API, there are some limitations to keep in mind. In the current release, we support only two metadata types: page layouts and the records of custom metadata types. Reading, creating, and updating metadata are supported, but deleting metadata is not supported.