@modelcontextprotocol/sdk 1.21.1 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/client/auth.d.ts.map +1 -1
  2. package/dist/cjs/client/auth.js +2 -2
  3. package/dist/cjs/client/auth.js.map +1 -1
  4. package/dist/cjs/client/index.d.ts +747 -1432
  5. package/dist/cjs/client/index.d.ts.map +1 -1
  6. package/dist/cjs/client/index.js +74 -0
  7. package/dist/cjs/client/index.js.map +1 -1
  8. package/dist/cjs/examples/client/simpleStreamableHttp.js +1 -1
  9. package/dist/cjs/examples/client/simpleStreamableHttp.js.map +1 -1
  10. package/dist/cjs/examples/server/elicitationExample.js +2 -4
  11. package/dist/cjs/examples/server/elicitationExample.js.map +1 -1
  12. package/dist/cjs/server/index.d.ts +47 -47
  13. package/dist/cjs/server/index.js +3 -3
  14. package/dist/cjs/server/index.js.map +1 -1
  15. package/dist/cjs/server/mcp.d.ts +5 -5
  16. package/dist/cjs/server/mcp.d.ts.map +1 -1
  17. package/dist/cjs/server/mcp.js +23 -2
  18. package/dist/cjs/server/mcp.js.map +1 -1
  19. package/dist/cjs/shared/metadataUtils.d.ts +5 -1
  20. package/dist/cjs/shared/metadataUtils.d.ts.map +1 -1
  21. package/dist/cjs/shared/metadataUtils.js +2 -5
  22. package/dist/cjs/shared/metadataUtils.js.map +1 -1
  23. package/dist/cjs/shared/protocol.d.ts +2 -1
  24. package/dist/cjs/shared/protocol.d.ts.map +1 -1
  25. package/dist/cjs/shared/protocol.js +15 -6
  26. package/dist/cjs/shared/protocol.js.map +1 -1
  27. package/dist/cjs/shared/toolNameValidation.d.ts +31 -0
  28. package/dist/cjs/shared/toolNameValidation.d.ts.map +1 -0
  29. package/dist/cjs/shared/toolNameValidation.js +97 -0
  30. package/dist/cjs/shared/toolNameValidation.js.map +1 -0
  31. package/dist/cjs/shared/transport.d.ts +1 -1
  32. package/dist/cjs/shared/transport.d.ts.map +1 -1
  33. package/dist/cjs/spec.types.d.ts +459 -211
  34. package/dist/cjs/spec.types.d.ts.map +1 -1
  35. package/dist/cjs/spec.types.js +1 -2
  36. package/dist/cjs/spec.types.js.map +1 -1
  37. package/dist/cjs/types.d.ts +19117 -54214
  38. package/dist/cjs/types.d.ts.map +1 -1
  39. package/dist/cjs/types.js +440 -338
  40. package/dist/cjs/types.js.map +1 -1
  41. package/dist/esm/client/auth.d.ts.map +1 -1
  42. package/dist/esm/client/auth.js +2 -2
  43. package/dist/esm/client/auth.js.map +1 -1
  44. package/dist/esm/client/index.d.ts +747 -1432
  45. package/dist/esm/client/index.d.ts.map +1 -1
  46. package/dist/esm/client/index.js +75 -1
  47. package/dist/esm/client/index.js.map +1 -1
  48. package/dist/esm/examples/client/simpleStreamableHttp.js +1 -1
  49. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
  50. package/dist/esm/examples/server/elicitationExample.js +2 -4
  51. package/dist/esm/examples/server/elicitationExample.js.map +1 -1
  52. package/dist/esm/server/index.d.ts +47 -47
  53. package/dist/esm/server/index.js +3 -3
  54. package/dist/esm/server/index.js.map +1 -1
  55. package/dist/esm/server/mcp.d.ts +5 -5
  56. package/dist/esm/server/mcp.d.ts.map +1 -1
  57. package/dist/esm/server/mcp.js +24 -3
  58. package/dist/esm/server/mcp.js.map +1 -1
  59. package/dist/esm/shared/metadataUtils.d.ts +5 -1
  60. package/dist/esm/shared/metadataUtils.d.ts.map +1 -1
  61. package/dist/esm/shared/metadataUtils.js +2 -5
  62. package/dist/esm/shared/metadataUtils.js.map +1 -1
  63. package/dist/esm/shared/protocol.d.ts +2 -1
  64. package/dist/esm/shared/protocol.d.ts.map +1 -1
  65. package/dist/esm/shared/protocol.js +15 -6
  66. package/dist/esm/shared/protocol.js.map +1 -1
  67. package/dist/esm/shared/toolNameValidation.d.ts +31 -0
  68. package/dist/esm/shared/toolNameValidation.d.ts.map +1 -0
  69. package/dist/esm/shared/toolNameValidation.js +92 -0
  70. package/dist/esm/shared/toolNameValidation.js.map +1 -0
  71. package/dist/esm/shared/transport.d.ts +1 -1
  72. package/dist/esm/shared/transport.d.ts.map +1 -1
  73. package/dist/esm/spec.types.d.ts +459 -211
  74. package/dist/esm/spec.types.d.ts.map +1 -1
  75. package/dist/esm/spec.types.js +1 -2
  76. package/dist/esm/spec.types.js.map +1 -1
  77. package/dist/esm/types.d.ts +19117 -54214
  78. package/dist/esm/types.d.ts.map +1 -1
  79. package/dist/esm/types.js +435 -335
  80. package/dist/esm/types.js.map +1 -1
  81. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Source: https://github.com/modelcontextprotocol/modelcontextprotocol
5
5
  * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts
6
- * Last updated from commit: 50671e92e71da830b101c7d1162b44fbddcbef30
6
+ * Last updated from commit: 11ad2a720d8e2f54881235f734121db0bda39052
7
7
  *
8
8
  * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates.
9
9
  * To update this file, run: npm run fetch:spec-types
@@ -26,20 +26,34 @@ export type ProgressToken = string | number;
26
26
  * An opaque token used to represent a cursor for pagination.
27
27
  */
28
28
  export type Cursor = string;
29
+ /**
30
+ * Common params for any request.
31
+ */
32
+ export interface RequestParams {
33
+ /**
34
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
35
+ */
36
+ _meta?: {
37
+ /**
38
+ * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
39
+ */
40
+ progressToken?: ProgressToken;
41
+ [key: string]: unknown;
42
+ };
43
+ }
29
44
  /** @internal */
30
45
  export interface Request {
31
46
  method: string;
32
47
  params?: {
33
- /**
34
- * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
35
- */
36
- _meta?: {
37
- /**
38
- * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
39
- */
40
- progressToken?: ProgressToken;
41
- [key: string]: unknown;
42
- };
48
+ [key: string]: any;
49
+ };
50
+ }
51
+ /** @internal */
52
+ export interface NotificationParams {
53
+ /**
54
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
55
+ */
56
+ _meta?: {
43
57
  [key: string]: unknown;
44
58
  };
45
59
  }
@@ -47,13 +61,7 @@ export interface Request {
47
61
  export interface Notification {
48
62
  method: string;
49
63
  params?: {
50
- /**
51
- * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
52
- */
53
- _meta?: {
54
- [key: string]: unknown;
55
- };
56
- [key: string]: unknown;
64
+ [key: string]: any;
57
65
  };
58
66
  }
59
67
  export interface Result {
@@ -126,6 +134,23 @@ export interface JSONRPCError {
126
134
  * A response that indicates success but carries no data.
127
135
  */
128
136
  export type EmptyResult = Result;
137
+ /**
138
+ * Parameters for a `notifications/cancelled` notification.
139
+ *
140
+ * @category notifications/cancelled
141
+ */
142
+ export interface CancelledNotificationParams extends NotificationParams {
143
+ /**
144
+ * The ID of the request to cancel.
145
+ *
146
+ * This MUST correspond to the ID of a request previously issued in the same direction.
147
+ */
148
+ requestId: RequestId;
149
+ /**
150
+ * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
151
+ */
152
+ reason?: string;
153
+ }
129
154
  /**
130
155
  * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
131
156
  *
@@ -139,18 +164,20 @@ export type EmptyResult = Result;
139
164
  */
140
165
  export interface CancelledNotification extends JSONRPCNotification {
141
166
  method: "notifications/cancelled";
142
- params: {
143
- /**
144
- * The ID of the request to cancel.
145
- *
146
- * This MUST correspond to the ID of a request previously issued in the same direction.
147
- */
148
- requestId: RequestId;
149
- /**
150
- * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
151
- */
152
- reason?: string;
153
- };
167
+ params: CancelledNotificationParams;
168
+ }
169
+ /**
170
+ * Parameters for an `initialize` request.
171
+ *
172
+ * @category initialize
173
+ */
174
+ export interface InitializeRequestParams extends RequestParams {
175
+ /**
176
+ * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
177
+ */
178
+ protocolVersion: string;
179
+ capabilities: ClientCapabilities;
180
+ clientInfo: Implementation;
154
181
  }
155
182
  /**
156
183
  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
@@ -159,14 +186,7 @@ export interface CancelledNotification extends JSONRPCNotification {
159
186
  */
160
187
  export interface InitializeRequest extends JSONRPCRequest {
161
188
  method: "initialize";
162
- params: {
163
- /**
164
- * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
165
- */
166
- protocolVersion: string;
167
- capabilities: ClientCapabilities;
168
- clientInfo: Implementation;
169
- };
189
+ params: InitializeRequestParams;
170
190
  }
171
191
  /**
172
192
  * After receiving an initialize request from the client, the server sends this response.
@@ -194,6 +214,7 @@ export interface InitializeResult extends Result {
194
214
  */
195
215
  export interface InitializedNotification extends JSONRPCNotification {
196
216
  method: "notifications/initialized";
217
+ params?: NotificationParams;
197
218
  }
198
219
  /**
199
220
  * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
@@ -309,7 +330,7 @@ export interface Icon {
309
330
  *
310
331
  * If not provided, the client should assume the icon can be used with any theme.
311
332
  */
312
- theme?: 'light' | 'dark';
333
+ theme?: "light" | "dark";
313
334
  }
314
335
  /**
315
336
  * Base interface to add `icons` property.
@@ -369,6 +390,34 @@ export interface Implementation extends BaseMetadata, Icons {
369
390
  */
370
391
  export interface PingRequest extends JSONRPCRequest {
371
392
  method: "ping";
393
+ params?: RequestParams;
394
+ }
395
+ /**
396
+ * Parameters for a `notifications/progress` notification.
397
+ *
398
+ * @category notifications/progress
399
+ */
400
+ export interface ProgressNotificationParams extends NotificationParams {
401
+ /**
402
+ * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
403
+ */
404
+ progressToken: ProgressToken;
405
+ /**
406
+ * The progress thus far. This should increase every time progress is made, even if the total is unknown.
407
+ *
408
+ * @TJS-type number
409
+ */
410
+ progress: number;
411
+ /**
412
+ * Total number of items to process (or total progress required), if known.
413
+ *
414
+ * @TJS-type number
415
+ */
416
+ total?: number;
417
+ /**
418
+ * An optional message describing the current progress.
419
+ */
420
+ message?: string;
372
421
  }
373
422
  /**
374
423
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
@@ -377,38 +426,21 @@ export interface PingRequest extends JSONRPCRequest {
377
426
  */
378
427
  export interface ProgressNotification extends JSONRPCNotification {
379
428
  method: "notifications/progress";
380
- params: {
381
- /**
382
- * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
383
- */
384
- progressToken: ProgressToken;
385
- /**
386
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
387
- *
388
- * @TJS-type number
389
- */
390
- progress: number;
391
- /**
392
- * Total number of items to process (or total progress required), if known.
393
- *
394
- * @TJS-type number
395
- */
396
- total?: number;
397
- /**
398
- * An optional message describing the current progress.
399
- */
400
- message?: string;
401
- };
429
+ params: ProgressNotificationParams;
430
+ }
431
+ /**
432
+ * Common parameters for paginated requests.
433
+ */
434
+ export interface PaginatedRequestParams extends RequestParams {
435
+ /**
436
+ * An opaque token representing the current pagination position.
437
+ * If provided, the server should return results starting after this cursor.
438
+ */
439
+ cursor?: Cursor;
402
440
  }
403
441
  /** @internal */
404
442
  export interface PaginatedRequest extends JSONRPCRequest {
405
- params?: {
406
- /**
407
- * An opaque token representing the current pagination position.
408
- * If provided, the server should return results starting after this cursor.
409
- */
410
- cursor?: Cursor;
411
- };
443
+ params?: PaginatedRequestParams;
412
444
  }
413
445
  /** @internal */
414
446
  export interface PaginatedResult extends Result {
@@ -450,6 +482,26 @@ export interface ListResourceTemplatesRequest extends PaginatedRequest {
450
482
  export interface ListResourceTemplatesResult extends PaginatedResult {
451
483
  resourceTemplates: ResourceTemplate[];
452
484
  }
485
+ /**
486
+ * Common parameters when working with resources.
487
+ *
488
+ * @internal
489
+ */
490
+ export interface ResourceRequestParams extends RequestParams {
491
+ /**
492
+ * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
493
+ *
494
+ * @format uri
495
+ */
496
+ uri: string;
497
+ }
498
+ /**
499
+ * Parameters for a `resources/read` request.
500
+ *
501
+ * @category resources/read
502
+ */
503
+ export interface ReadResourceRequestParams extends ResourceRequestParams {
504
+ }
453
505
  /**
454
506
  * Sent from the client to the server, to read a specific resource URI.
455
507
  *
@@ -457,14 +509,7 @@ export interface ListResourceTemplatesResult extends PaginatedResult {
457
509
  */
458
510
  export interface ReadResourceRequest extends JSONRPCRequest {
459
511
  method: "resources/read";
460
- params: {
461
- /**
462
- * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
463
- *
464
- * @format uri
465
- */
466
- uri: string;
467
- };
512
+ params: ReadResourceRequestParams;
468
513
  }
469
514
  /**
470
515
  * The server's response to a resources/read request from the client.
@@ -481,6 +526,14 @@ export interface ReadResourceResult extends Result {
481
526
  */
482
527
  export interface ResourceListChangedNotification extends JSONRPCNotification {
483
528
  method: "notifications/resources/list_changed";
529
+ params?: NotificationParams;
530
+ }
531
+ /**
532
+ * Parameters for a `resources/subscribe` request.
533
+ *
534
+ * @category resources/subscribe
535
+ */
536
+ export interface SubscribeRequestParams extends ResourceRequestParams {
484
537
  }
485
538
  /**
486
539
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
@@ -489,14 +542,14 @@ export interface ResourceListChangedNotification extends JSONRPCNotification {
489
542
  */
490
543
  export interface SubscribeRequest extends JSONRPCRequest {
491
544
  method: "resources/subscribe";
492
- params: {
493
- /**
494
- * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
495
- *
496
- * @format uri
497
- */
498
- uri: string;
499
- };
545
+ params: SubscribeRequestParams;
546
+ }
547
+ /**
548
+ * Parameters for a `resources/unsubscribe` request.
549
+ *
550
+ * @category resources/unsubscribe
551
+ */
552
+ export interface UnsubscribeRequestParams extends ResourceRequestParams {
500
553
  }
501
554
  /**
502
555
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
@@ -505,14 +558,20 @@ export interface SubscribeRequest extends JSONRPCRequest {
505
558
  */
506
559
  export interface UnsubscribeRequest extends JSONRPCRequest {
507
560
  method: "resources/unsubscribe";
508
- params: {
509
- /**
510
- * The URI of the resource to unsubscribe from.
511
- *
512
- * @format uri
513
- */
514
- uri: string;
515
- };
561
+ params: UnsubscribeRequestParams;
562
+ }
563
+ /**
564
+ * Parameters for a `notifications/resources/updated` notification.
565
+ *
566
+ * @category notifications/resources/updated
567
+ */
568
+ export interface ResourceUpdatedNotificationParams extends NotificationParams {
569
+ /**
570
+ * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
571
+ *
572
+ * @format uri
573
+ */
574
+ uri: string;
516
575
  }
517
576
  /**
518
577
  * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
@@ -521,14 +580,7 @@ export interface UnsubscribeRequest extends JSONRPCRequest {
521
580
  */
522
581
  export interface ResourceUpdatedNotification extends JSONRPCNotification {
523
582
  method: "notifications/resources/updated";
524
- params: {
525
- /**
526
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
527
- *
528
- * @format uri
529
- */
530
- uri: string;
531
- };
583
+ params: ResourceUpdatedNotificationParams;
532
584
  }
533
585
  /**
534
586
  * A known resource that the server is capable of reading.
@@ -649,6 +701,23 @@ export interface ListPromptsRequest extends PaginatedRequest {
649
701
  export interface ListPromptsResult extends PaginatedResult {
650
702
  prompts: Prompt[];
651
703
  }
704
+ /**
705
+ * Parameters for a `prompts/get` request.
706
+ *
707
+ * @category prompts/get
708
+ */
709
+ export interface GetPromptRequestParams extends RequestParams {
710
+ /**
711
+ * The name of the prompt or prompt template.
712
+ */
713
+ name: string;
714
+ /**
715
+ * Arguments to use for templating the prompt.
716
+ */
717
+ arguments?: {
718
+ [key: string]: string;
719
+ };
720
+ }
652
721
  /**
653
722
  * Used by the client to get a prompt provided by the server.
654
723
  *
@@ -656,18 +725,7 @@ export interface ListPromptsResult extends PaginatedResult {
656
725
  */
657
726
  export interface GetPromptRequest extends JSONRPCRequest {
658
727
  method: "prompts/get";
659
- params: {
660
- /**
661
- * The name of the prompt or prompt template.
662
- */
663
- name: string;
664
- /**
665
- * Arguments to use for templating the prompt.
666
- */
667
- arguments?: {
668
- [key: string]: string;
669
- };
670
- };
728
+ params: GetPromptRequestParams;
671
729
  }
672
730
  /**
673
731
  * The server's response to a prompts/get request from the client.
@@ -762,6 +820,7 @@ export interface EmbeddedResource {
762
820
  */
763
821
  export interface PromptListChangedNotification extends JSONRPCNotification {
764
822
  method: "notifications/prompts/list_changed";
823
+ params?: NotificationParams;
765
824
  }
766
825
  /**
767
826
  * Sent from the client to request a list of tools the server has.
@@ -811,6 +870,23 @@ export interface CallToolResult extends Result {
811
870
  */
812
871
  isError?: boolean;
813
872
  }
873
+ /**
874
+ * Parameters for a `tools/call` request.
875
+ *
876
+ * @category tools/call
877
+ */
878
+ export interface CallToolRequestParams extends RequestParams {
879
+ /**
880
+ * The name of the tool.
881
+ */
882
+ name: string;
883
+ /**
884
+ * Arguments to use for the tool call.
885
+ */
886
+ arguments?: {
887
+ [key: string]: unknown;
888
+ };
889
+ }
814
890
  /**
815
891
  * Used by the client to invoke a tool provided by the server.
816
892
  *
@@ -818,12 +894,7 @@ export interface CallToolResult extends Result {
818
894
  */
819
895
  export interface CallToolRequest extends JSONRPCRequest {
820
896
  method: "tools/call";
821
- params: {
822
- name: string;
823
- arguments?: {
824
- [key: string]: unknown;
825
- };
826
- };
897
+ params: CallToolRequestParams;
827
898
  }
828
899
  /**
829
900
  * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
@@ -832,6 +903,7 @@ export interface CallToolRequest extends JSONRPCRequest {
832
903
  */
833
904
  export interface ToolListChangedNotification extends JSONRPCNotification {
834
905
  method: "notifications/tools/list_changed";
906
+ params?: NotificationParams;
835
907
  }
836
908
  /**
837
909
  * Additional properties describing a Tool to clients.
@@ -926,6 +998,17 @@ export interface Tool extends BaseMetadata, Icons {
926
998
  [key: string]: unknown;
927
999
  };
928
1000
  }
1001
+ /**
1002
+ * Parameters for a `logging/setLevel` request.
1003
+ *
1004
+ * @category logging/setLevel
1005
+ */
1006
+ export interface SetLevelRequestParams extends RequestParams {
1007
+ /**
1008
+ * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
1009
+ */
1010
+ level: LoggingLevel;
1011
+ }
929
1012
  /**
930
1013
  * A request from the client to the server, to enable or adjust logging.
931
1014
  *
@@ -933,12 +1016,26 @@ export interface Tool extends BaseMetadata, Icons {
933
1016
  */
934
1017
  export interface SetLevelRequest extends JSONRPCRequest {
935
1018
  method: "logging/setLevel";
936
- params: {
937
- /**
938
- * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
939
- */
940
- level: LoggingLevel;
941
- };
1019
+ params: SetLevelRequestParams;
1020
+ }
1021
+ /**
1022
+ * Parameters for a `notifications/message` notification.
1023
+ *
1024
+ * @category notifications/message
1025
+ */
1026
+ export interface LoggingMessageNotificationParams extends NotificationParams {
1027
+ /**
1028
+ * The severity of this log message.
1029
+ */
1030
+ level: LoggingLevel;
1031
+ /**
1032
+ * An optional name of the logger issuing this message.
1033
+ */
1034
+ logger?: string;
1035
+ /**
1036
+ * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
1037
+ */
1038
+ data: unknown;
942
1039
  }
943
1040
  /**
944
1041
  * JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
@@ -947,20 +1044,7 @@ export interface SetLevelRequest extends JSONRPCRequest {
947
1044
  */
948
1045
  export interface LoggingMessageNotification extends JSONRPCNotification {
949
1046
  method: "notifications/message";
950
- params: {
951
- /**
952
- * The severity of this log message.
953
- */
954
- level: LoggingLevel;
955
- /**
956
- * An optional name of the logger issuing this message.
957
- */
958
- logger?: string;
959
- /**
960
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
961
- */
962
- data: unknown;
963
- };
1047
+ params: LoggingMessageNotificationParams;
964
1048
  }
965
1049
  /**
966
1050
  * The severity of a log message.
@@ -969,6 +1053,41 @@ export interface LoggingMessageNotification extends JSONRPCNotification {
969
1053
  * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
970
1054
  */
971
1055
  export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
1056
+ /**
1057
+ * Parameters for a `sampling/createMessage` request.
1058
+ *
1059
+ * @category sampling/createMessage
1060
+ */
1061
+ export interface CreateMessageRequestParams extends RequestParams {
1062
+ messages: SamplingMessage[];
1063
+ /**
1064
+ * The server's preferences for which model to select. The client MAY ignore these preferences.
1065
+ */
1066
+ modelPreferences?: ModelPreferences;
1067
+ /**
1068
+ * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1069
+ */
1070
+ systemPrompt?: string;
1071
+ /**
1072
+ * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
1073
+ */
1074
+ includeContext?: "none" | "thisServer" | "allServers";
1075
+ /**
1076
+ * @TJS-type number
1077
+ */
1078
+ temperature?: number;
1079
+ /**
1080
+ * The requested maximum number of tokens to sample (to prevent runaway completions).
1081
+ *
1082
+ * The client MAY choose to sample fewer tokens than the requested maximum.
1083
+ */
1084
+ maxTokens: number;
1085
+ stopSequences?: string[];
1086
+ /**
1087
+ * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1088
+ */
1089
+ metadata?: object;
1090
+ }
972
1091
  /**
973
1092
  * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
974
1093
  *
@@ -976,36 +1095,7 @@ export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "
976
1095
  */
977
1096
  export interface CreateMessageRequest extends JSONRPCRequest {
978
1097
  method: "sampling/createMessage";
979
- params: {
980
- messages: SamplingMessage[];
981
- /**
982
- * The server's preferences for which model to select. The client MAY ignore these preferences.
983
- */
984
- modelPreferences?: ModelPreferences;
985
- /**
986
- * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
987
- */
988
- systemPrompt?: string;
989
- /**
990
- * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
991
- */
992
- includeContext?: "none" | "thisServer" | "allServers";
993
- /**
994
- * @TJS-type number
995
- */
996
- temperature?: number;
997
- /**
998
- * The requested maximum number of tokens to sample (to prevent runaway completions).
999
- *
1000
- * The client MAY choose to sample fewer tokens than the requested maximum.
1001
- */
1002
- maxTokens: number;
1003
- stopSequences?: string[];
1004
- /**
1005
- * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1006
- */
1007
- metadata?: object;
1008
- };
1098
+ params: CreateMessageRequestParams;
1009
1099
  }
1010
1100
  /**
1011
1101
  * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
@@ -1210,40 +1300,46 @@ export interface ModelHint {
1210
1300
  name?: string;
1211
1301
  }
1212
1302
  /**
1213
- * A request from the client to the server, to ask for completion options.
1303
+ * Parameters for a `completion/complete` request.
1214
1304
  *
1215
1305
  * @category completion/complete
1216
1306
  */
1217
- export interface CompleteRequest extends JSONRPCRequest {
1218
- method: "completion/complete";
1219
- params: {
1220
- ref: PromptReference | ResourceTemplateReference;
1307
+ export interface CompleteRequestParams extends RequestParams {
1308
+ ref: PromptReference | ResourceTemplateReference;
1309
+ /**
1310
+ * The argument's information
1311
+ */
1312
+ argument: {
1221
1313
  /**
1222
- * The argument's information
1314
+ * The name of the argument
1223
1315
  */
1224
- argument: {
1225
- /**
1226
- * The name of the argument
1227
- */
1228
- name: string;
1229
- /**
1230
- * The value of the argument to use for completion matching.
1231
- */
1232
- value: string;
1233
- };
1316
+ name: string;
1234
1317
  /**
1235
- * Additional, optional context for completions
1318
+ * The value of the argument to use for completion matching.
1236
1319
  */
1237
- context?: {
1238
- /**
1239
- * Previously-resolved variables in a URI template or prompt.
1240
- */
1241
- arguments?: {
1242
- [key: string]: string;
1243
- };
1320
+ value: string;
1321
+ };
1322
+ /**
1323
+ * Additional, optional context for completions
1324
+ */
1325
+ context?: {
1326
+ /**
1327
+ * Previously-resolved variables in a URI template or prompt.
1328
+ */
1329
+ arguments?: {
1330
+ [key: string]: string;
1244
1331
  };
1245
1332
  };
1246
1333
  }
1334
+ /**
1335
+ * A request from the client to the server, to ask for completion options.
1336
+ *
1337
+ * @category completion/complete
1338
+ */
1339
+ export interface CompleteRequest extends JSONRPCRequest {
1340
+ method: "completion/complete";
1341
+ params: CompleteRequestParams;
1342
+ }
1247
1343
  /**
1248
1344
  * The server's response to a completion/complete request
1249
1345
  *
@@ -1296,6 +1392,7 @@ export interface PromptReference extends BaseMetadata {
1296
1392
  */
1297
1393
  export interface ListRootsRequest extends JSONRPCRequest {
1298
1394
  method: "roots/list";
1395
+ params?: RequestParams;
1299
1396
  }
1300
1397
  /**
1301
1398
  * The client's response to a roots/list request from the server.
@@ -1341,6 +1438,29 @@ export interface Root {
1341
1438
  */
1342
1439
  export interface RootsListChangedNotification extends JSONRPCNotification {
1343
1440
  method: "notifications/roots/list_changed";
1441
+ params?: NotificationParams;
1442
+ }
1443
+ /**
1444
+ * Parameters for an `elicitation/create` request.
1445
+ *
1446
+ * @category elicitation/create
1447
+ */
1448
+ export interface ElicitRequestParams extends RequestParams {
1449
+ /**
1450
+ * The message to present to the user.
1451
+ */
1452
+ message: string;
1453
+ /**
1454
+ * A restricted subset of JSON Schema.
1455
+ * Only top-level properties are allowed, without nesting.
1456
+ */
1457
+ requestedSchema: {
1458
+ type: "object";
1459
+ properties: {
1460
+ [key: string]: PrimitiveSchemaDefinition;
1461
+ };
1462
+ required?: string[];
1463
+ };
1344
1464
  }
1345
1465
  /**
1346
1466
  * A request from the server to elicit additional information from the user via the client.
@@ -1349,23 +1469,7 @@ export interface RootsListChangedNotification extends JSONRPCNotification {
1349
1469
  */
1350
1470
  export interface ElicitRequest extends JSONRPCRequest {
1351
1471
  method: "elicitation/create";
1352
- params: {
1353
- /**
1354
- * The message to present to the user.
1355
- */
1356
- message: string;
1357
- /**
1358
- * A restricted subset of JSON Schema.
1359
- * Only top-level properties are allowed, without nesting.
1360
- */
1361
- requestedSchema: {
1362
- type: "object";
1363
- properties: {
1364
- [key: string]: PrimitiveSchemaDefinition;
1365
- };
1366
- required?: string[];
1367
- };
1368
- };
1472
+ params: ElicitRequestParams;
1369
1473
  }
1370
1474
  /**
1371
1475
  * Restricted schema definitions that only allow primitive types
@@ -1395,14 +1499,158 @@ export interface BooleanSchema {
1395
1499
  description?: string;
1396
1500
  default?: boolean;
1397
1501
  }
1398
- export interface EnumSchema {
1502
+ /**
1503
+ * Schema for single-selection enumeration without display titles for options.
1504
+ */
1505
+ export interface UntitledSingleSelectEnumSchema {
1506
+ type: "string";
1507
+ /**
1508
+ * Optional title for the enum field.
1509
+ */
1510
+ title?: string;
1511
+ /**
1512
+ * Optional description for the enum field.
1513
+ */
1514
+ description?: string;
1515
+ /**
1516
+ * Array of enum values to choose from.
1517
+ */
1518
+ enum: string[];
1519
+ /**
1520
+ * Optional default value.
1521
+ */
1522
+ default?: string;
1523
+ }
1524
+ /**
1525
+ * Schema for single-selection enumeration with display titles for each option.
1526
+ */
1527
+ export interface TitledSingleSelectEnumSchema {
1528
+ type: "string";
1529
+ /**
1530
+ * Optional title for the enum field.
1531
+ */
1532
+ title?: string;
1533
+ /**
1534
+ * Optional description for the enum field.
1535
+ */
1536
+ description?: string;
1537
+ /**
1538
+ * Array of enum options with values and display labels.
1539
+ */
1540
+ oneOf: Array<{
1541
+ /**
1542
+ * The enum value.
1543
+ */
1544
+ const: string;
1545
+ /**
1546
+ * Display label for this option.
1547
+ */
1548
+ title: string;
1549
+ }>;
1550
+ /**
1551
+ * Optional default value.
1552
+ */
1553
+ default?: string;
1554
+ }
1555
+ export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema;
1556
+ /**
1557
+ * Schema for multiple-selection enumeration without display titles for options.
1558
+ */
1559
+ export interface UntitledMultiSelectEnumSchema {
1560
+ type: "array";
1561
+ /**
1562
+ * Optional title for the enum field.
1563
+ */
1564
+ title?: string;
1565
+ /**
1566
+ * Optional description for the enum field.
1567
+ */
1568
+ description?: string;
1569
+ /**
1570
+ * Minimum number of items to select.
1571
+ */
1572
+ minItems?: number;
1573
+ /**
1574
+ * Maximum number of items to select.
1575
+ */
1576
+ maxItems?: number;
1577
+ /**
1578
+ * Schema for the array items.
1579
+ */
1580
+ items: {
1581
+ type: "string";
1582
+ /**
1583
+ * Array of enum values to choose from.
1584
+ */
1585
+ enum: string[];
1586
+ };
1587
+ /**
1588
+ * Optional default value.
1589
+ */
1590
+ default?: string[];
1591
+ }
1592
+ /**
1593
+ * Schema for multiple-selection enumeration with display titles for each option.
1594
+ */
1595
+ export interface TitledMultiSelectEnumSchema {
1596
+ type: "array";
1597
+ /**
1598
+ * Optional title for the enum field.
1599
+ */
1600
+ title?: string;
1601
+ /**
1602
+ * Optional description for the enum field.
1603
+ */
1604
+ description?: string;
1605
+ /**
1606
+ * Minimum number of items to select.
1607
+ */
1608
+ minItems?: number;
1609
+ /**
1610
+ * Maximum number of items to select.
1611
+ */
1612
+ maxItems?: number;
1613
+ /**
1614
+ * Schema for array items with enum options and display labels.
1615
+ */
1616
+ items: {
1617
+ /**
1618
+ * Array of enum options with values and display labels.
1619
+ */
1620
+ anyOf: Array<{
1621
+ /**
1622
+ * The constant enum value.
1623
+ */
1624
+ const: string;
1625
+ /**
1626
+ * Display title for this option.
1627
+ */
1628
+ title: string;
1629
+ }>;
1630
+ };
1631
+ /**
1632
+ * Optional default value.
1633
+ */
1634
+ default?: string[];
1635
+ }
1636
+ export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema;
1637
+ /**
1638
+ * Use TitledSingleSelectEnumSchema instead.
1639
+ * This interface will be removed in a future version.
1640
+ */
1641
+ export interface LegacyTitledEnumSchema {
1399
1642
  type: "string";
1400
1643
  title?: string;
1401
1644
  description?: string;
1402
1645
  enum: string[];
1646
+ /**
1647
+ * (Legacy) Display names for enum values.
1648
+ * Non-standard according to JSON schema 2020-12.
1649
+ */
1403
1650
  enumNames?: string[];
1404
1651
  default?: string;
1405
1652
  }
1653
+ export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema;
1406
1654
  /**
1407
1655
  * The client's response to an elicitation request.
1408
1656
  *
@@ -1421,7 +1669,7 @@ export interface ElicitResult extends Result {
1421
1669
  * Contains values matching the requested schema.
1422
1670
  */
1423
1671
  content?: {
1424
- [key: string]: string | number | boolean;
1672
+ [key: string]: string | number | boolean | string[];
1425
1673
  };
1426
1674
  }
1427
1675
  /** @internal */