@@ -39,18 +39,18 @@ export const RequestSchema = z.object({
39
39
params : z . optional ( BaseRequestParamsSchema ) ,
40
40
} ) ;
41
41
42
+ const BaseNotificationParamsSchema = z
43
+ . object ( {
44
+ /**
45
+ * This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
46
+ */
47
+ _meta : z . optional ( z . object ( { } ) . passthrough ( ) ) ,
48
+ } )
49
+ . passthrough ( ) ;
50
+
42
51
export const NotificationSchema = z . object ( {
43
52
method : z . string ( ) ,
44
- params : z . optional (
45
- z
46
- . object ( {
47
- /**
48
- * This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
49
- */
50
- _meta : z . optional ( z . object ( { } ) . passthrough ( ) ) ,
51
- } )
52
- . passthrough ( ) ,
53
- ) ,
53
+ params : z . optional ( BaseNotificationParamsSchema ) ,
54
54
} ) ;
55
55
56
56
export const ResultSchema = z
@@ -312,7 +312,7 @@ export const ProgressSchema = z
312
312
*/
313
313
export const ProgressNotificationSchema = NotificationSchema . extend ( {
314
314
method : z . literal ( "notifications/progress" ) ,
315
- params : ProgressSchema . extend ( {
315
+ params : BaseNotificationParamsSchema . merge ( ProgressSchema ) . extend ( {
316
316
/**
317
317
* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
318
318
*/
@@ -522,14 +522,12 @@ export const UnsubscribeRequestSchema = RequestSchema.extend({
522
522
*/
523
523
export const ResourceUpdatedNotificationSchema = NotificationSchema . extend ( {
524
524
method : z . literal ( "notifications/resources/updated" ) ,
525
- params : z
526
- . object ( {
527
- /**
528
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
529
- */
530
- uri : z . string ( ) ,
531
- } )
532
- . passthrough ( ) ,
525
+ params : BaseNotificationParamsSchema . extend ( {
526
+ /**
527
+ * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
528
+ */
529
+ uri : z . string ( ) ,
530
+ } ) ,
533
531
} ) ;
534
532
535
533
/* Prompts */
@@ -786,22 +784,20 @@ export const SetLevelRequestSchema = RequestSchema.extend({
786
784
*/
787
785
export const LoggingMessageNotificationSchema = NotificationSchema . extend ( {
788
786
method : z . literal ( "notifications/message" ) ,
789
- params : z
790
- . object ( {
791
- /**
792
- * The severity of this log message.
793
- */
794
- level : LoggingLevelSchema ,
795
- /**
796
- * An optional name of the logger issuing this message.
797
- */
798
- logger : z . optional ( z . string ( ) ) ,
799
- /**
800
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
801
- */
802
- data : z . unknown ( ) ,
803
- } )
804
- . passthrough ( ) ,
787
+ params : BaseNotificationParamsSchema . extend ( {
788
+ /**
789
+ * The severity of this log message.
790
+ */
791
+ level : LoggingLevelSchema ,
792
+ /**
793
+ * An optional name of the logger issuing this message.
794
+ */
795
+ logger : z . optional ( z . string ( ) ) ,
796
+ /**
797
+ * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
798
+ */
799
+ data : z . unknown ( ) ,
800
+ } ) ,
805
801
} ) ;
806
802
807
803
/* Sampling */
0 commit comments