File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
java-cfenv-boot-tanzu-genai/src/main/java/io/pivotal/cfenv/boot/genai Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,9 @@ public List<McpConnectivity> getMcpServers() {
231231
232232 private List <ModelConnectivity > getAllModelConnectivityDetails () {
233233 ConfigEndpoint e = getEndpointConfig ();
234+ if (e .advertisedModels == null ) {
235+ return List .of ();
236+ }
234237 return e .advertisedModels
235238 .stream ()
236239 .map ( a ->
@@ -239,14 +242,24 @@ private List<ModelConnectivity> getAllModelConnectivityDetails() {
239242 a .capabilities (),
240243 a .labels (),
241244 apiKey ,
242- apiBase + e .wireFormat ().toLowerCase ())
245+ merge ( apiBase , e .wireFormat ().toLowerCase () ))
243246 )
244247 .toList ();
245248 }
246249
250+ private String merge (String apiBase , String wireFormat ) {
251+ if (apiBase .endsWith ("/" )) {
252+ return apiBase + wireFormat ;
253+ }
254+ return apiBase + "/" + wireFormat ;
255+ }
256+
247257 private List <McpConnectivity > getAllMcpConnectivityDetails () {
248- return getEndpointConfig ()
249- .advertisedMcpServers
258+ ConfigEndpoint e = getEndpointConfig ();
259+ if (e .advertisedMcpServers == null ) {
260+ return List .of ();
261+ }
262+ return e .advertisedMcpServers
250263 .stream ()
251264 .map (m -> new McpConnectivity (m .url ()))
252265 .toList ();
You can’t perform that action at this time.
0 commit comments