@@ -165,7 +165,7 @@ export class Client<
165
165
case "logging/setLevel" :
166
166
if ( ! this . _serverCapabilities ?. logging ) {
167
167
throw new Error (
168
- " Server does not support logging (required for logging/setLevel)" ,
168
+ ` Server does not support logging (required for ${ method } )` ,
169
169
) ;
170
170
}
171
171
break ;
@@ -194,7 +194,9 @@ export class Client<
194
194
method === "resources/subscribe" &&
195
195
! this . _serverCapabilities . resources . subscribe
196
196
) {
197
- throw new Error ( "Server does not support resource subscriptions" ) ;
197
+ throw new Error (
198
+ `Server does not support resource subscriptions (required for ${ method } )` ,
199
+ ) ;
198
200
}
199
201
200
202
break ;
@@ -211,7 +213,7 @@ export class Client<
211
213
case "completion/complete" :
212
214
if ( ! this . _serverCapabilities ?. prompts ) {
213
215
throw new Error (
214
- " Server does not support prompts (required for completion/complete)" ,
216
+ ` Server does not support prompts (required for ${ method } )` ,
215
217
) ;
216
218
}
217
219
break ;
@@ -233,7 +235,7 @@ export class Client<
233
235
case "notifications/roots/list_changed" :
234
236
if ( ! this . _capabilities . roots ?. listChanged ) {
235
237
throw new Error (
236
- " Client does not support roots list changed notifications" ,
238
+ ` Client does not support roots list changed notifications (required for ${ method } )` ,
237
239
) ;
238
240
}
239
241
break ;
@@ -252,13 +254,17 @@ export class Client<
252
254
switch ( method ) {
253
255
case "sampling/createMessage" :
254
256
if ( ! this . _capabilities . sampling ) {
255
- throw new Error ( "Client does not support sampling capability" ) ;
257
+ throw new Error (
258
+ `Client does not support sampling capability (required for ${ method } )` ,
259
+ ) ;
256
260
}
257
261
break ;
258
262
259
263
case "roots/list" :
260
264
if ( ! this . _capabilities . roots ) {
261
- throw new Error ( "Client does not support roots capability" ) ;
265
+ throw new Error (
266
+ `Client does not support roots capability (required for ${ method } )` ,
267
+ ) ;
262
268
}
263
269
break ;
264
270
0 commit comments