Remove explicit constants of method names, factor out ProgressSchema
This commit is contained in:
parent
0e2b156a7d
commit
4be31d0f08
1 changed files with 16 additions and 24 deletions
|
|
@ -8,10 +8,10 @@ import {
|
|||
McpError,
|
||||
METHOD_NOT_FOUND,
|
||||
Notification,
|
||||
PING_REQUEST_METHOD,
|
||||
PingRequestSchema,
|
||||
Progress,
|
||||
PROGRESS_NOTIFICATION_METHOD,
|
||||
ProgressNotification,
|
||||
ProgressNotificationSchema,
|
||||
Request,
|
||||
Result,
|
||||
} from "../types.js";
|
||||
|
|
@ -78,14 +78,14 @@ export class Protocol<
|
|||
|
||||
constructor() {
|
||||
this.setNotificationHandler(
|
||||
PROGRESS_NOTIFICATION_METHOD,
|
||||
ProgressNotificationSchema.shape.method.value,
|
||||
(notification) => {
|
||||
this._onprogress(notification as unknown as ProgressNotification);
|
||||
},
|
||||
);
|
||||
|
||||
this.setRequestHandler(
|
||||
PING_REQUEST_METHOD,
|
||||
PingRequestSchema.shape.method.value,
|
||||
// Automatic pong by default.
|
||||
(_request) => ({}) as SendResultT,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue