@@ -263,24 +263,27 @@ export const PingRequestSchema = RequestSchema.extend({
263
263
} ) ;
264
264
265
265
/* Progress notifications */
266
+ export const ProgressSchema = z . object ( {
267
+ /**
268
+ * The progress thus far. This should increase every time progress is made, even if the total is unknown.
269
+ */
270
+ progress : z . number ( ) ,
271
+ /**
272
+ * Total number of items to process (or total progress required), if known.
273
+ */
274
+ total : z . optional ( z . number ( ) ) ,
275
+ } ) ;
276
+
266
277
/**
267
278
* An out-of-band notification used to inform the receiver of a progress update for a long-running request.
268
279
*/
269
280
export const ProgressNotificationSchema = NotificationSchema . extend ( {
270
281
method : z . literal ( "notifications/progress" ) ,
271
- params : z . object ( {
282
+ params : ProgressSchema . extend ( {
272
283
/**
273
284
* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
274
285
*/
275
286
progressToken : ProgressTokenSchema ,
276
- /**
277
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
278
- */
279
- progress : z . number ( ) ,
280
- /**
281
- * Total number of items to process (or total progress required), if known.
282
- */
283
- total : z . optional ( z . number ( ) ) ,
284
287
} ) ,
285
288
} ) ;
286
289
@@ -810,14 +813,3 @@ export class McpError extends Error {
810
813
super ( `MCP error ${ code } : ${ message } ` ) ;
811
814
}
812
815
}
813
-
814
- export type Progress = Pick <
815
- z . infer < typeof ProgressNotificationSchema > [ "params" ] ,
816
- "progress" | "total"
817
- > ;
818
-
819
- export const PROGRESS_NOTIFICATION_METHOD : z . infer <
820
- typeof ProgressNotificationSchema
821
- > [ "method" ] = "notifications/progress" ;
822
- export const PING_REQUEST_METHOD : z . infer < typeof PingRequestSchema > [ "method" ] =
823
- "ping" ;
0 commit comments