File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed
Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -406,22 +406,18 @@ export class McpdClient {
406406 ) ;
407407
408408 // Process results and transform prompt names.
409- const allPrompts : Prompt [ ] = [ ] ;
410- for ( const result of results ) {
411- if ( result . status === "fulfilled" ) {
412- const { serverName, prompts } = result . value ;
413- // Transform prompt names to serverName__promptName format.
414- for ( const prompt of prompts ) {
415- allPrompts . push ( {
416- ...prompt ,
417- name : `${ serverName } __${ prompt . name } ` ,
418- } ) ;
419- }
420- } else {
421- // If we can't get prompts for a server, skip it with a warning.
422- console . warn ( `Failed to get prompts for server:` , result . reason ) ;
423- }
424- }
409+ const allPrompts : Prompt [ ] = results . flatMap ( result => {
410+ if ( result . status === "fulfilled" ) {
411+ const { serverName, prompts } = result . value ;
412+ return prompts . map ( prompt => ( {
413+ ...prompt ,
414+ name : `${ serverName } __${ prompt . name } ` ,
415+ } ) ) ;
416+ } else {
417+ console . warn ( `Failed to get prompts for server:` , result . reason ) ;
418+ return [ ] ; // Return an empty array for rejected promises
419+ }
420+ } ) ;
425421
426422 return allPrompts ;
427423 }
You can’t perform that action at this time.
0 commit comments