Skip to content

Commit e36f880

Browse files
authored
Merge pull request #706 from cliffhall/add-toast-for-misconfigured-logging
Add toast for misconfigured logging
2 parents 618370d + 0d8e8fc commit e36f880

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

client/src/lib/hooks/useConnection.ts

Lines changed: 14 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,17 @@ export function useConnection({
578581
setMcpClient(client);
579582
setConnectionStatus("connected");
580583
} catch (e) {
584+
if (
585+
lastRequest === "logging/setLevel" &&
586+
e instanceof McpError &&
587+
e.code === ErrorCode.MethodNotFound
588+
) {
589+
toast({
590+
title: "Error",
591+
description: `Server declares logging capability but doesn't implement method: "${lastRequest}"`,
592+
variant: "destructive",
593+
});
594+
}
581595
console.error(e);
582596
setConnectionStatus("error");
583597
}

0 commit comments

Comments
 (0)