@@ -28,10 +28,9 @@ import { Action2, registerAction2 } from '../../../../../platform/actions/common
28
28
import { CommandsRegistry } from '../../../../../platform/commands/common/commands.js' ;
29
29
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js' ;
30
30
import { FileKind , IFileService } from '../../../../../platform/files/common/files.js' ;
31
- import { ServicesAccessor } from '../../../../../platform/instantiation/common/instantiation.js' ;
31
+ import { IInstantiationService , ServicesAccessor } from '../../../../../platform/instantiation/common/instantiation.js' ;
32
32
import { ILabelService } from '../../../../../platform/label/common/label.js' ;
33
33
import { INotificationService } from '../../../../../platform/notification/common/notification.js' ;
34
- import { IQuickInputService } from '../../../../../platform/quickinput/common/quickInput.js' ;
35
34
import { Registry } from '../../../../../platform/registry/common/platform.js' ;
36
35
import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js' ;
37
36
import { IWorkbenchContributionsRegistry , Extensions as WorkbenchExtensions } from '../../../../common/contributions.js' ;
@@ -40,6 +39,7 @@ import { IEditorService } from '../../../../services/editor/common/editorService
40
39
import { IHistoryService } from '../../../../services/history/common/history.js' ;
41
40
import { LifecyclePhase } from '../../../../services/lifecycle/common/lifecycle.js' ;
42
41
import { ISearchService } from '../../../../services/search/common/search.js' ;
42
+ import { McpPromptArgumentPick } from '../../../mcp/browser/mcpPromptArgumentPick.js' ;
43
43
import { IMcpPrompt , IMcpPromptMessage , IMcpServer , IMcpService , McpResourceURI } from '../../../mcp/common/mcpTypes.js' ;
44
44
import { searchFilesAndFolders } from '../../../search/browser/chatContributions.js' ;
45
45
import { IChatAgentData , IChatAgentNameService , IChatAgentService , getFullyQualifiedId } from '../../common/chatAgents.js' ;
@@ -545,7 +545,7 @@ class StartParameterizedPromptAction extends Action2 {
545
545
return ;
546
546
}
547
547
548
- const quickInputService = accessor . get ( IQuickInputService ) ;
548
+ const instantiationService = accessor . get ( IInstantiationService ) ;
549
549
const notificationService = accessor . get ( INotificationService ) ;
550
550
const widgetService = accessor . get ( IChatWidgetService ) ;
551
551
const fileService = accessor . get ( IFileService ) ;
@@ -564,51 +564,21 @@ class StartParameterizedPromptAction extends Action2 {
564
564
} ;
565
565
566
566
const store = new DisposableStore ( ) ;
567
- const quickInput = store . add ( quickInputService . createInputBox ( ) ) ;
567
+ const pick = store . add ( instantiationService . createInstance ( McpPromptArgumentPick , prompt ) ) ;
568
568
569
569
try {
570
- // remove fake /command if hidden before accepting
571
- store . add ( quickInput . onDidHide ( ( ) => replaceTextWith ( '' ) ) ) ;
572
-
573
- quickInput . totalSteps = prompt . arguments . length ;
574
- quickInput . step = 0 ;
575
- quickInput . ignoreFocusOut = true ;
576
-
577
- const args : Record < string , string > = { } ;
578
- for ( const arg of prompt . arguments ) {
579
- quickInput . step ++ ;
580
- quickInput . placeholder = arg . name ;
581
- quickInput . description = arg . required ? arg . description : `${ arg . description || '' } (${ localize ( 'optional' , 'Optional' ) } )` ;
582
- quickInput . value = '' ;
583
-
584
- const value = await new Promise < string | undefined > ( resolve => {
585
- store . add ( quickInput . onDidAccept ( ( ) => {
586
- resolve ( quickInput . value ) ;
587
- } ) ) ;
588
- store . add ( quickInput . onDidHide ( ( ) => {
589
- resolve ( undefined ) ;
590
- store . dispose ( ) ;
591
- } ) ) ;
592
- quickInput . show ( ) ;
593
- } ) ;
594
-
595
- if ( value === undefined || ( value === '' && arg . required ) ) {
596
- store . dispose ( ) ;
597
- return ;
598
- }
599
-
600
- args [ arg . name ] = value ;
570
+ const args = await pick . createArgs ( ) ;
571
+ if ( ! args ) {
572
+ replaceTextWith ( '' ) ;
573
+ return ;
601
574
}
602
575
603
- quickInput . value = '' ;
604
- quickInput . placeholder = localize ( 'loading' , 'Loading...' ) ;
605
- quickInput . busy = true ;
606
-
607
576
let messages : IMcpPromptMessage [ ] ;
608
577
try {
609
578
messages = await prompt . resolve ( args ) ;
610
579
} catch ( e ) {
611
580
notificationService . error ( localize ( 'mcp.prompt.error' , "Error resolving prompt: {0}" , String ( e ) ) ) ;
581
+ replaceTextWith ( '' ) ;
612
582
return ;
613
583
}
614
584
0 commit comments