class PipelineMetadataService implements ApiRoutable {

    @GET
    @TreeResponse
    public ExportedDescribableModel[] doAgentMetadata() {
        List<ExportedDescribableModel> models = new ArrayList<>();

        for (DeclarativeAgentDescriptor d : DeclarativeAgentDescriptor.all()) {
            try {
                DescribableModel<? extends DeclarativeAgent> model = new DescribableModel<>(d.clazz);

                String symbol = symbolForObject(d);
                if ("label".equals(symbol)) { // Label has 2 symbols, but we need "node"
                    symbol = "node";
                }
                models.add(new ExportedDescribableModel(model, symbol));
            } catch (NoStaplerConstructorException e) {
                // Ignore!
            }
        }
        return models.toArray(new ExportedDescribableModel[models.size()]);
    }

}