Merge branch 'main' into fix-214
This commit is contained in:
@@ -371,36 +371,37 @@ const Sidebar = ({
|
|||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<a
|
<Button variant="ghost" title="Inspector Documentation" asChild>
|
||||||
href="https://modelcontextprotocol.io/docs/tools/inspector"
|
<a
|
||||||
target="_blank"
|
href="https://modelcontextprotocol.io/docs/tools/inspector"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
<Button variant="ghost" title="Inspector Documentation">
|
|
||||||
<CircleHelp className="w-4 h-4 text-gray-800" />
|
|
||||||
</Button>
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://modelcontextprotocol.io/docs/tools/debugging"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<Button variant="ghost" title="Debugging Guide">
|
|
||||||
<Bug className="w-4 h-4 text-gray-800" />
|
|
||||||
</Button>
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://github.com/modelcontextprotocol/inspector"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
title="Report bugs or contribute on GitHub"
|
|
||||||
>
|
>
|
||||||
<Github className="w-4 h-4 text-gray-800" />
|
<CircleHelp className="w-4 h-4 text-foreground" />
|
||||||
</Button>
|
</a>
|
||||||
</a>
|
</Button>
|
||||||
|
<Button variant="ghost" title="Debugging Guide" asChild>
|
||||||
|
<a
|
||||||
|
href="https://modelcontextprotocol.io/docs/tools/debugging"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<Bug className="w-4 h-4 text-foreground" />
|
||||||
|
</a>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
title="Report bugs or contribute on GitHub"
|
||||||
|
asChild
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
href="https://github.com/modelcontextprotocol/inspector"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<Github className="w-4 h-4 text-foreground" />
|
||||||
|
</a>
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import {
|
|||||||
McpError,
|
McpError,
|
||||||
CompleteResultSchema,
|
CompleteResultSchema,
|
||||||
ErrorCode,
|
ErrorCode,
|
||||||
|
CancelledNotificationSchema,
|
||||||
|
ResourceListChangedNotificationSchema,
|
||||||
|
ToolListChangedNotificationSchema,
|
||||||
|
PromptListChangedNotificationSchema,
|
||||||
} from "@modelcontextprotocol/sdk/types.js";
|
} from "@modelcontextprotocol/sdk/types.js";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
@@ -250,20 +254,24 @@ export function useConnection({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (onNotification) {
|
if (onNotification) {
|
||||||
client.setNotificationHandler(
|
[
|
||||||
|
CancelledNotificationSchema,
|
||||||
ProgressNotificationSchema,
|
ProgressNotificationSchema,
|
||||||
onNotification,
|
|
||||||
);
|
|
||||||
|
|
||||||
client.setNotificationHandler(
|
|
||||||
ResourceUpdatedNotificationSchema,
|
|
||||||
onNotification,
|
|
||||||
);
|
|
||||||
|
|
||||||
client.setNotificationHandler(
|
|
||||||
LoggingMessageNotificationSchema,
|
LoggingMessageNotificationSchema,
|
||||||
onNotification,
|
ResourceUpdatedNotificationSchema,
|
||||||
);
|
ResourceListChangedNotificationSchema,
|
||||||
|
ToolListChangedNotificationSchema,
|
||||||
|
PromptListChangedNotificationSchema,
|
||||||
|
].forEach((notificationSchema) => {
|
||||||
|
client.setNotificationHandler(notificationSchema, onNotification);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.fallbackNotificationHandler = (
|
||||||
|
notification: Notification,
|
||||||
|
): Promise<void> => {
|
||||||
|
onNotification(notification);
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onStdErrNotification) {
|
if (onStdErrNotification) {
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ export const StdErrNotificationSchema = BaseNotificationSchema.extend({
|
|||||||
|
|
||||||
export const NotificationSchema = ClientNotificationSchema.or(
|
export const NotificationSchema = ClientNotificationSchema.or(
|
||||||
StdErrNotificationSchema,
|
StdErrNotificationSchema,
|
||||||
).or(ServerNotificationSchema);
|
)
|
||||||
|
.or(ServerNotificationSchema)
|
||||||
|
.or(BaseNotificationSchema);
|
||||||
|
|
||||||
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
|
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
|
||||||
export type Notification = z.infer<typeof NotificationSchema>;
|
export type Notification = z.infer<typeof NotificationSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user