Skip to content

Commit 15b58c8

Browse files
committed
This fixes #610
* In useConnection.ts - During initialization, if there is an error immediately following the client sending 'logging/setLevel', pops up a toast with the message `Server declares logging capability but doesn't implement method "logging/setLevel"`
1 parent 618370d commit 15b58c8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/src/lib/hooks/useConnection.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export function useConnection({
351351
return;
352352
}
353353

354+
let lastRequest = "";
354355
try {
355356
// Inject auth manually instead of using SSEClientTransport, because we're
356357
// proxying through the inspector server first.
@@ -564,7 +565,9 @@ export function useConnection({
564565
}
565566

566567
if (capabilities?.logging && defaultLoggingLevel) {
568+
lastRequest = "logging/setLevel";
567569
await client.setLoggingLevel(defaultLoggingLevel);
570+
lastRequest = "";
568571
}
569572

570573
if (onElicitationRequest) {
@@ -578,6 +581,13 @@ export function useConnection({
578581
setMcpClient(client);
579582
setConnectionStatus("connected");
580583
} catch (e) {
584+
if (lastRequest === "logging/setLevel" && e instanceof McpError && e.code === ErrorCode.MethodNotFound) {
585+
toast({
586+
title: "Error",
587+
description: `Server declares logging capability but doesn't implement method: "${lastRequest}"`,
588+
variant: "destructive",
589+
});
590+
}
581591
console.error(e);
582592
setConnectionStatus("error");
583593
}

0 commit comments

Comments
 (0)