Service lookup based on metadata

I have a requirement where in a service wants to looks up another service (configured in YAML, could be MESH_EXTENAL also) based on metadata. Basically I am trying to replicate the EUREKA service discovery.
But I do not see any mechanism to search for a service in the registry. I thought of writing a utility to parse the YAML and get the service details. But, this YAML will not be accessible for a running service, right?
Is there any other way to lookup a service?