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"`
This commit is contained in:
parent
618370dd08
commit
15b58c8142
1 changed files with 10 additions and 0 deletions
|
|
@ -351,6 +351,7 @@ export function useConnection({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let lastRequest = "";
|
||||||
try {
|
try {
|
||||||
// Inject auth manually instead of using SSEClientTransport, because we're
|
// Inject auth manually instead of using SSEClientTransport, because we're
|
||||||
// proxying through the inspector server first.
|
// proxying through the inspector server first.
|
||||||
|
|
@ -564,7 +565,9 @@ export function useConnection({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capabilities?.logging && defaultLoggingLevel) {
|
if (capabilities?.logging && defaultLoggingLevel) {
|
||||||
|
lastRequest = "logging/setLevel";
|
||||||
await client.setLoggingLevel(defaultLoggingLevel);
|
await client.setLoggingLevel(defaultLoggingLevel);
|
||||||
|
lastRequest = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onElicitationRequest) {
|
if (onElicitationRequest) {
|
||||||
|
|
@ -578,6 +581,13 @@ export function useConnection({
|
||||||
setMcpClient(client);
|
setMcpClient(client);
|
||||||
setConnectionStatus("connected");
|
setConnectionStatus("connected");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (lastRequest === "logging/setLevel" && e instanceof McpError && e.code === ErrorCode.MethodNotFound) {
|
||||||
|
toast({
|
||||||
|
title: "Error",
|
||||||
|
description: `Server declares logging capability but doesn't implement method: "${lastRequest}"`,
|
||||||
|
variant: "destructive",
|
||||||
|
});
|
||||||
|
}
|
||||||
console.error(e);
|
console.error(e);
|
||||||
setConnectionStatus("error");
|
setConnectionStatus("error");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue