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 = ({
4848 ref : PromptReference | ResourceReference ,
4949 argName : string ,
5050 value : string ,
51+ context ?: Record < string , string > ,
5152 ) => Promise < string [ ] > ;
5253 completionsSupported : boolean ;
5354 promptContent : string ;
@@ -73,6 +74,7 @@ const PromptsTab = ({
7374 } ,
7475 argName ,
7576 value ,
77+ promptArgs ,
7678 ) ;
7779 }
7880 } ;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ const ResourcesTab = ({
5252 ref : ResourceReference | PromptReference ,
5353 argName : string ,
5454 value : string ,
55+ context ?: Record < string , string > ,
5556 ) => Promise < string [ ] > ;
5657 completionsSupported : boolean ;
5758 resourceContent : string ;
@@ -94,6 +95,7 @@ const ResourcesTab = ({
9495 } ,
9596 key ,
9697 value ,
98+ templateValues ,
9799 ) ;
98100 }
99101 } ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function useCompletionState(
2828 ref : ResourceReference | PromptReference ,
2929 argName : string ,
3030 value : string ,
31+ context ?: Record < string , string > ,
3132 signal ?: AbortSignal ,
3233 ) => Promise < string [ ] > ,
3334 completionsSupported : boolean = true ,
@@ -66,6 +67,7 @@ export function useCompletionState(
6667 ref : ResourceReference | PromptReference ,
6768 argName : string ,
6869 value : string ,
70+ context ?: Record < string , string > ,
6971 ) => {
7072 if ( ! completionsSupported ) {
7173 return ;
@@ -82,10 +84,15 @@ export function useCompletionState(
8284 } ) ) ;
8385
8486 try {
87+ if ( context !== undefined ) {
88+ delete context [ argName ] ;
89+ }
90+
8591 const values = await handleCompletion (
8692 ref ,
8793 argName ,
8894 value ,
95+ context ,
8996 abortController . signal ,
9097 ) ;
9198
@@ -97,6 +104,7 @@ export function useCompletionState(
97104 } ) ) ;
98105 }
99106 } catch {
107+ console . error ( "completion failed" ) ;
100108 if ( ! abortController . signal . aborted ) {
101109 setState ( ( prev ) => ( {
102110 ...prev ,
Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ export function useConnection({
198198 ref : ResourceReference | PromptReference ,
199199 argName : string ,
200200 value : string ,
201+ context ?: Record < string , string > ,
201202 signal ?: AbortSignal ,
202203 ) : Promise < string [ ] > => {
203204 if ( ! mcpClient || ! completionsSupported ) {
@@ -215,6 +216,12 @@ export function useConnection({
215216 } ,
216217 } ;
217218
219+ if ( context ) {
220+ request [ "params" ] [ "context" ] = {
221+ arguments : context ,
222+ } ;
223+ }
224+
218225 try {
219226 const response = await makeRequest ( request , CompleteResultSchema , {
220227 signal,
You can’t perform that action at this time.
0 commit comments