File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ const PromptsTab = ({
48
48
ref : PromptReference | ResourceReference ,
49
49
argName : string ,
50
50
value : string ,
51
+ context ?: Record < string , string > ,
51
52
) => Promise < string [ ] > ;
52
53
completionsSupported : boolean ;
53
54
promptContent : string ;
@@ -73,6 +74,7 @@ const PromptsTab = ({
73
74
} ,
74
75
argName ,
75
76
value ,
77
+ promptArgs ,
76
78
) ;
77
79
}
78
80
} ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ const ResourcesTab = ({
52
52
ref : ResourceReference | PromptReference ,
53
53
argName : string ,
54
54
value : string ,
55
+ context ?: Record < string , string > ,
55
56
) => Promise < string [ ] > ;
56
57
completionsSupported : boolean ;
57
58
resourceContent : string ;
@@ -94,6 +95,7 @@ const ResourcesTab = ({
94
95
} ,
95
96
key ,
96
97
value ,
98
+ templateValues ,
97
99
) ;
98
100
}
99
101
} ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function useCompletionState(
28
28
ref : ResourceReference | PromptReference ,
29
29
argName : string ,
30
30
value : string ,
31
+ context ?: Record < string , string > ,
31
32
signal ?: AbortSignal ,
32
33
) => Promise < string [ ] > ,
33
34
completionsSupported : boolean = true ,
@@ -66,6 +67,7 @@ export function useCompletionState(
66
67
ref : ResourceReference | PromptReference ,
67
68
argName : string ,
68
69
value : string ,
70
+ context ?: Record < string , string > ,
69
71
) => {
70
72
if ( ! completionsSupported ) {
71
73
return ;
@@ -82,10 +84,15 @@ export function useCompletionState(
82
84
} ) ) ;
83
85
84
86
try {
87
+ if ( context !== undefined ) {
88
+ delete context [ argName ] ;
89
+ }
90
+
85
91
const values = await handleCompletion (
86
92
ref ,
87
93
argName ,
88
94
value ,
95
+ context ,
89
96
abortController . signal ,
90
97
) ;
91
98
@@ -97,6 +104,7 @@ export function useCompletionState(
97
104
} ) ) ;
98
105
}
99
106
} catch {
107
+ console . error ( "completion failed" ) ;
100
108
if ( ! abortController . signal . aborted ) {
101
109
setState ( ( prev ) => ( {
102
110
...prev ,
Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ export function useConnection({
198
198
ref : ResourceReference | PromptReference ,
199
199
argName : string ,
200
200
value : string ,
201
+ context ?: Record < string , string > ,
201
202
signal ?: AbortSignal ,
202
203
) : Promise < string [ ] > => {
203
204
if ( ! mcpClient || ! completionsSupported ) {
@@ -215,6 +216,12 @@ export function useConnection({
215
216
} ,
216
217
} ;
217
218
219
+ if ( context ) {
220
+ request [ "params" ] [ "context" ] = {
221
+ arguments : context ,
222
+ } ;
223
+ }
224
+
218
225
try {
219
226
const response = await makeRequest ( request , CompleteResultSchema , {
220
227
signal,
You can’t perform that action at this time.
0 commit comments