@@ -263,24 +263,27 @@ export const PingRequestSchema = RequestSchema.extend({
263263} ) ;
264264
265265/* 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+
266277/**
267278 * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
268279 */
269280export const ProgressNotificationSchema = NotificationSchema . extend ( {
270281 method : z . literal ( "notifications/progress" ) ,
271- params : z . object ( {
282+ params : ProgressSchema . extend ( {
272283 /**
273284 * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
274285 */
275286 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 ( ) ) ,
284287 } ) ,
285288} ) ;
286289
@@ -810,14 +813,3 @@ export class McpError extends Error {
810813 super ( `MCP error ${ code } : ${ message } ` ) ;
811814 }
812815}
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