@@ -97,24 +97,37 @@ export function CommandPalette({
9797 name : tool . name ,
9898 description : tool . description ,
9999 type : 'tool' as const ,
100- category : 'Tools' ,
101- metadata : tool . inputSchema ,
100+ category : ( tool as any ) . _serverName ? `Tools - ${ ( tool as any ) . _serverName } ` : 'Tools' ,
101+ metadata : {
102+ inputSchema : tool . inputSchema ,
103+ serverId : ( tool as any ) . _serverId ,
104+ serverName : ( tool as any ) . _serverName ,
105+ } ,
102106 } ) ) ,
103107 ...prompts . map ( prompt => ( {
104108 id : `prompt-${ prompt . name } ` ,
105109 name : prompt . name ,
106110 description : prompt . description ,
107111 type : 'prompt' as const ,
108- category : 'Prompts' ,
109- metadata : prompt . arguments ,
112+ category : ( prompt as any ) . _serverName ? `Prompts - ${ ( prompt as any ) . _serverName } ` : 'Prompts' ,
113+ metadata : {
114+ arguments : prompt . arguments ,
115+ serverId : ( prompt as any ) . _serverId ,
116+ serverName : ( prompt as any ) . _serverName ,
117+ } ,
110118 } ) ) ,
111119 ...resources . map ( resource => ( {
112120 id : `resource-${ resource . uri } ` ,
113121 name : resource . name ,
114122 description : resource . description ,
115123 type : 'resource' as const ,
116- category : 'Resources' ,
117- metadata : { uri : resource . uri , mimeType : resource . mimeType } ,
124+ category : ( resource as any ) . _serverName ? `Resources - ${ ( resource as any ) . _serverName } ` : 'Resources' ,
125+ metadata : {
126+ uri : resource . uri ,
127+ mimeType : resource . mimeType ,
128+ serverId : ( resource as any ) . _serverId ,
129+ serverName : ( resource as any ) . _serverName ,
130+ } ,
118131 } ) ) ,
119132 ]
120133
@@ -131,6 +144,10 @@ export function CommandPalette({
131144 }
132145 }
133146 else {
147+ // If the item belongs to a specific server, switch to that server first
148+ if ( item . metadata ?. serverId ) {
149+ onServerSelect ( item . metadata . serverId )
150+ }
134151 onNavigate ( item . type as 'tools' | 'prompts' | 'resources' , item . name )
135152 onOpenChange ( false )
136153 }
@@ -161,12 +178,12 @@ export function CommandPalette({
161178 }
162179
163180 const getMetadataPreview = ( item : CommandItem ) => {
164- if ( item . type === 'tool' && item . metadata ?. properties ) {
165- const props = Object . keys ( item . metadata . properties )
181+ if ( item . type === 'tool' && item . metadata ?. inputSchema ?. properties ) {
182+ const props = Object . keys ( item . metadata . inputSchema . properties )
166183 return props . length > 0 ? `${ props . length } parameter${ props . length > 1 ? 's' : '' } ` : 'No parameters'
167184 }
168- if ( item . type === 'prompt' && item . metadata ) {
169- const args = Object . keys ( item . metadata )
185+ if ( item . type === 'prompt' && item . metadata ?. arguments ) {
186+ const args = Object . keys ( item . metadata . arguments )
170187 return args . length > 0 ? `${ args . length } argument${ args . length > 1 ? 's' : '' } ` : 'No arguments'
171188 }
172189 if ( item . type === 'resource' && item . metadata ?. mimeType ) {
0 commit comments