@@ -165,7 +165,7 @@ export class Client<
165165 case "logging/setLevel" :
166166 if ( ! this . _serverCapabilities ?. logging ) {
167167 throw new Error (
168- " Server does not support logging (required for logging/setLevel)" ,
168+ ` Server does not support logging (required for ${ method } )` ,
169169 ) ;
170170 }
171171 break ;
@@ -194,7 +194,9 @@ export class Client<
194194 method === "resources/subscribe" &&
195195 ! this . _serverCapabilities . resources . subscribe
196196 ) {
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+ ) ;
198200 }
199201
200202 break ;
@@ -211,7 +213,7 @@ export class Client<
211213 case "completion/complete" :
212214 if ( ! this . _serverCapabilities ?. prompts ) {
213215 throw new Error (
214- " Server does not support prompts (required for completion/complete)" ,
216+ ` Server does not support prompts (required for ${ method } )` ,
215217 ) ;
216218 }
217219 break ;
@@ -233,7 +235,7 @@ export class Client<
233235 case "notifications/roots/list_changed" :
234236 if ( ! this . _capabilities . roots ?. listChanged ) {
235237 throw new Error (
236- " Client does not support roots list changed notifications" ,
238+ ` Client does not support roots list changed notifications (required for ${ method } )` ,
237239 ) ;
238240 }
239241 break ;
@@ -252,13 +254,17 @@ export class Client<
252254 switch ( method ) {
253255 case "sampling/createMessage" :
254256 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+ ) ;
256260 }
257261 break ;
258262
259263 case "roots/list" :
260264 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+ ) ;
262268 }
263269 break ;
264270
0 commit comments