tmcp 1.20.0 → 1.20.1

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.
@@ -1,22 +1,8 @@
1
1
  import { JSONRPCErrorException } from 'json-rpc-2.0';
2
2
  import * as v from 'valibot';
3
- import {
4
- LATEST_PROTOCOL_VERSION,
5
- MODERN_PROTOCOL_VERSION,
6
- SUPPORTED_VERSIONS,
7
- } from './version.js';
8
3
 
9
- export { LATEST_PROTOCOL_VERSION, MODERN_PROTOCOL_VERSION };
10
- export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';
11
- /**
12
- * Supported session-negotiated protocol versions. Re-exported from
13
- * `validation/version.js`, which is the single source of truth.
14
- * Note: `2024-10-07` was dropped from this list — it was never actually
15
- * negotiable.
16
- */
17
- export const SUPPORTED_PROTOCOL_VERSIONS = SUPPORTED_VERSIONS;
18
4
  /* JSON-RPC types */
19
- export const JSONRPC_VERSION = '2.0';
5
+ const JSONRPC_VERSION = '2.0';
20
6
 
21
7
  /* Modern protocol error codes (2026-07-28) */
22
8
 
@@ -59,6 +45,7 @@ export class McpError extends JSONRPCErrorException {
59
45
  /**
60
46
  * Create a `MISSING_REQUIRED_CLIENT_CAPABILITY` (-32021) error.
61
47
  * @param {Record<string, unknown>} required_capabilities
48
+ * @internal
62
49
  */
63
50
  export function missing_required_client_capability_error(
64
51
  required_capabilities,
@@ -74,6 +61,7 @@ export function missing_required_client_capability_error(
74
61
  * Create an `UNSUPPORTED_PROTOCOL_VERSION` (-32022) error.
75
62
  * @param {string[]} supported
76
63
  * @param {string} requested
64
+ * @internal
77
65
  */
78
66
  export function unsupported_protocol_version_error(supported, requested) {
79
67
  return new McpError(
@@ -83,21 +71,10 @@ export function unsupported_protocol_version_error(supported, requested) {
83
71
  );
84
72
  }
85
73
 
86
- /**
87
- * Create a `HEADER_MISMATCH` (-32020) error.
88
- * @param {string} message
89
- */
90
- export function header_mismatch_error(message) {
91
- return new McpError(HEADER_MISMATCH, message);
92
- }
93
-
94
74
  /**
95
75
  * A uniquely identifying ID for a request in JSON-RPC.
96
76
  */
97
- export const RequestIdSchema = v.union([
98
- v.string(),
99
- v.pipe(v.number(), v.integer()),
100
- ]);
77
+ const RequestIdSchema = v.union([v.string(), v.pipe(v.number(), v.integer())]);
101
78
 
102
79
  /**
103
80
  * The severity of a log message.
@@ -116,7 +93,7 @@ export const LoggingLevelSchema = v.picklist([
116
93
  /**
117
94
  * A progress token, used to associate progress notifications with the original request.
118
95
  */
119
- export const ProgressTokenSchema = v.union([
96
+ const ProgressTokenSchema = v.union([
120
97
  v.string(),
121
98
  v.pipe(v.number(), v.integer()),
122
99
  ]);
@@ -124,7 +101,7 @@ export const ProgressTokenSchema = v.union([
124
101
  /**
125
102
  * An opaque token used to represent a cursor for pagination.
126
103
  */
127
- export const CursorSchema = v.string();
104
+ const CursorSchema = v.string();
128
105
 
129
106
  const RequestMetaSchema = v.looseObject({
130
107
  /**
@@ -137,7 +114,7 @@ const BaseRequestParamsSchema = v.looseObject({
137
114
  _meta: v.optional(RequestMetaSchema),
138
115
  });
139
116
 
140
- export const RequestSchema = v.object({
117
+ const RequestSchema = v.object({
141
118
  method: v.string(),
142
119
  params: v.optional(BaseRequestParamsSchema),
143
120
  });
@@ -158,11 +135,11 @@ const BaseNotificationParamsSchema = v.looseObject({
158
135
  const SubscriptionNotificationParamsSchema = v.looseObject({
159
136
  _meta: v.optional(SubscriptionNotificationMetaSchema),
160
137
  });
161
- export const NotificationSchema = v.object({
138
+ const NotificationSchema = v.object({
162
139
  method: v.string(),
163
140
  params: v.optional(BaseNotificationParamsSchema),
164
141
  });
165
- export const ResultSchema = v.looseObject({
142
+ const ResultSchema = v.looseObject({
166
143
  /**
167
144
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
168
145
  * for notes on _meta usage.
@@ -198,6 +175,7 @@ export const JSONRPCResponseSchema = v.strictObject({
198
175
 
199
176
  /**
200
177
  * A response to a request that indicates an error occurred.
178
+ * @internal
201
179
  */
202
180
  export const JSONRPCErrorSchema = v.strictObject({
203
181
  jsonrpc: v.literal(JSONRPC_VERSION),
@@ -230,7 +208,7 @@ export const JSONRPCMessageSchema = v.union([
230
208
  /**
231
209
  * A response that indicates success but carries no data.
232
210
  */
233
- export const EmptyResultSchema = v.strictObject({ ...ResultSchema.entries });
211
+ const EmptyResultSchema = v.strictObject({ ...ResultSchema.entries });
234
212
  /* Cancellation */
235
213
 
236
214
  /**
@@ -241,6 +219,7 @@ export const EmptyResultSchema = v.strictObject({ ...ResultSchema.entries });
241
219
  * This notification indicates that the result will be unused, so any associated processing SHOULD cease.
242
220
  *
243
221
  * A client MUST NOT attempt to cancel its `initialize` request.
222
+ * @internal
244
223
  */
245
224
  export const CancelledNotificationSchema = v.object({
246
225
  ...NotificationSchema.entries,
@@ -266,7 +245,7 @@ export const CancelledNotificationSchema = v.object({
266
245
  /**
267
246
  * Base metadata interface for common properties across resources, tools, prompts, and implementations.
268
247
  */
269
- export const BaseMetadataSchema = v.object({
248
+ const BaseMetadataSchema = v.object({
270
249
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
271
250
  name: v.string(),
272
251
 
@@ -284,7 +263,7 @@ export const BaseMetadataSchema = v.object({
284
263
  /**
285
264
  * Icon schema for use in tools, prompts, resources, and implementations.
286
265
  */
287
- export const IconSchema = v.object({
266
+ const IconSchema = v.object({
288
267
  /**
289
268
  * URL or data URI for the icon.
290
269
  */
@@ -302,7 +281,7 @@ export const IconSchema = v.object({
302
281
  sizes: v.optional(v.array(v.string())),
303
282
  });
304
283
 
305
- export const IconsSchema = v.object({
284
+ const IconsSchema = v.object({
306
285
  /**
307
286
  * Optional set of sized icons that the client can display in a user interface.
308
287
  *
@@ -385,19 +364,10 @@ export const InitializeRequestParamsSchema = v.object({
385
364
  clientInfo: ImplementationSchema,
386
365
  });
387
366
 
388
- /**
389
- * This request is sent from the client to the server when it first connects, asking it to begin initialization.
390
- */
391
- export const InitializeRequestSchema = v.object({
392
- ...RequestSchema.entries,
393
- method: v.literal('initialize'),
394
- params: InitializeRequestParamsSchema,
395
- });
396
-
397
367
  /**
398
368
  * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
399
369
  */
400
- export const ServerCapabilitiesSchema = v.object({
370
+ const ServerCapabilitiesSchema = v.object({
401
371
  /**
402
372
  * Experimental, non-standard capabilities that the server supports.
403
373
  */
@@ -464,7 +434,7 @@ export const ServerCapabilitiesSchema = v.object({
464
434
  /**
465
435
  * After receiving an initialize request from the client, the server sends this response.
466
436
  */
467
- export const InitializeResultSchema = v.object({
437
+ const InitializeResultSchema = v.object({
468
438
  ...ResultSchema.entries,
469
439
 
470
440
  /**
@@ -481,73 +451,7 @@ export const InitializeResultSchema = v.object({
481
451
  */
482
452
  instructions: v.optional(v.string()),
483
453
  });
484
-
485
- /**
486
- * This notification is sent from the client to the server after initialization has finished.
487
- */
488
- export const InitializedNotificationSchema = v.object({
489
- ...NotificationSchema.entries,
490
- method: v.literal('notifications/initialized'),
491
- });
492
- /* Ping */
493
-
494
- /**
495
- * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
496
- */
497
- export const PingRequestSchema = v.object({
498
- ...RequestSchema.entries,
499
- method: v.literal('ping'),
500
- });
501
- /* Progress notifications */
502
- export const ProgressSchema = v.object({
503
- /**
504
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
505
- */
506
- progress: v.number(),
507
-
508
- /**
509
- * Total number of items to process (or total progress required), if known.
510
- */
511
- total: v.optional(v.number()),
512
-
513
- /**
514
- * An optional message describing the current progress.
515
- */
516
- message: v.optional(v.string()),
517
- });
518
-
519
- /**
520
- * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
521
- */
522
- export const ProgressNotificationSchema = v.object({
523
- ...NotificationSchema.entries,
524
- method: v.literal('notifications/progress'),
525
- params: v.object({
526
- ...BaseNotificationParamsSchema.entries,
527
- ...ProgressSchema.entries,
528
-
529
- /**
530
- * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
531
- */
532
- progressToken: ProgressTokenSchema,
533
- }),
534
- });
535
- /* Pagination */
536
- export const PaginatedRequestSchema = v.object({
537
- ...RequestSchema.entries,
538
- params: v.optional(
539
- v.object({
540
- ...BaseRequestParamsSchema.entries,
541
-
542
- /**
543
- * An opaque token representing the current pagination position.
544
- * If provided, the server should return results starting after this cursor.
545
- */
546
- cursor: v.optional(CursorSchema),
547
- }),
548
- ),
549
- });
550
- export const PaginatedResultSchema = v.object({
454
+ const PaginatedResultSchema = v.object({
551
455
  ...ResultSchema.entries,
552
456
 
553
457
  /**
@@ -561,7 +465,7 @@ export const PaginatedResultSchema = v.object({
561
465
  /**
562
466
  * The contents of a specific resource or sub-resource.
563
467
  */
564
- export const ResourceContentsSchema = v.object({
468
+ const ResourceContentsSchema = v.object({
565
469
  /**
566
470
  * The URI of this resource.
567
471
  */
@@ -578,7 +482,7 @@ export const ResourceContentsSchema = v.object({
578
482
  */
579
483
  _meta: v.optional(v.looseObject({})),
580
484
  });
581
- export const TextResourceContentsSchema = v.object({
485
+ const TextResourceContentsSchema = v.object({
582
486
  ...ResourceContentsSchema.entries,
583
487
 
584
488
  /**
@@ -586,7 +490,7 @@ export const TextResourceContentsSchema = v.object({
586
490
  */
587
491
  text: v.string(),
588
492
  });
589
- export const BlobResourceContentsSchema = v.object({
493
+ const BlobResourceContentsSchema = v.object({
590
494
  ...ResourceContentsSchema.entries,
591
495
 
592
496
  /**
@@ -598,7 +502,7 @@ export const BlobResourceContentsSchema = v.object({
598
502
  /**
599
503
  * A known resource that the server is capable of reading.
600
504
  */
601
- export const ResourceSchema = v.object({
505
+ const ResourceSchema = v.object({
602
506
  ...BaseMetadataSchema.entries,
603
507
 
604
508
  /**
@@ -629,7 +533,7 @@ export const ResourceSchema = v.object({
629
533
  /**
630
534
  * A template description for resources available on the server.
631
535
  */
632
- export const ResourceTemplateSchema = v.object({
536
+ const ResourceTemplateSchema = v.object({
633
537
  ...BaseMetadataSchema.entries,
634
538
 
635
539
  /**
@@ -657,54 +561,22 @@ export const ResourceTemplateSchema = v.object({
657
561
  ...IconsSchema.entries,
658
562
  });
659
563
 
660
- /**
661
- * Sent from the client to request a list of resources the server has.
662
- */
663
- export const ListResourcesRequestSchema = v.object({
664
- ...PaginatedRequestSchema.entries,
665
- method: v.literal('resources/list'),
666
- });
667
-
668
564
  /**
669
565
  * The server's response to a resources/list request from the client.
670
566
  */
671
- export const ListResourcesResultSchema = v.object({
567
+ const ListResourcesResultSchema = v.object({
672
568
  ...PaginatedResultSchema.entries,
673
569
  resources: v.array(ResourceSchema),
674
570
  });
675
571
 
676
- /**
677
- * Sent from the client to request a list of resource templates the server has.
678
- */
679
- export const ListResourceTemplatesRequestSchema = v.object({
680
- ...PaginatedRequestSchema.entries,
681
- method: v.literal('resources/templates/list'),
682
- });
683
-
684
572
  /**
685
573
  * The server's response to a resources/templates/list request from the client.
686
574
  */
687
- export const ListResourceTemplatesResultSchema = v.object({
575
+ const ListResourceTemplatesResultSchema = v.object({
688
576
  ...PaginatedResultSchema.entries,
689
577
  resourceTemplates: v.array(ResourceTemplateSchema),
690
578
  });
691
579
 
692
- /**
693
- * Sent from the client to the server, to read a specific resource URI.
694
- */
695
- export const ReadResourceRequestSchema = v.object({
696
- ...RequestSchema.entries,
697
- method: v.literal('resources/read'),
698
- params: v.object({
699
- ...BaseRequestParamsSchema.entries,
700
-
701
- /**
702
- * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
703
- */
704
- uri: v.string(),
705
- }),
706
- });
707
-
708
580
  /**
709
581
  * The server's response to a resources/read request from the client.
710
582
  */
@@ -717,6 +589,7 @@ export const ReadResourceResultSchema = v.looseObject({
717
589
 
718
590
  /**
719
591
  * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
592
+ * @internal
720
593
  */
721
594
  export const ResourceListChangedNotificationSchema = v.object({
722
595
  ...NotificationSchema.entries,
@@ -728,7 +601,7 @@ export const ResourceListChangedNotificationSchema = v.object({
728
601
  * Notification types requested on a per-request subscription stream. Every field
729
602
  * is opt-in.
730
603
  */
731
- export const SubscriptionFilterSchema = v.object({
604
+ const SubscriptionFilterSchema = v.object({
732
605
  toolsListChanged: v.optional(v.boolean()),
733
606
  promptsListChanged: v.optional(v.boolean()),
734
607
  resourcesListChanged: v.optional(v.boolean()),
@@ -749,6 +622,7 @@ export const DiscoverRequestParamsSchema = v.looseObject({
749
622
 
750
623
  /**
751
624
  * Open a long-lived stream for server notifications.
625
+ * @internal
752
626
  */
753
627
  export const SubscriptionsListenRequestParamsSchema = v.object({
754
628
  ...BaseRequestParamsSchema.entries,
@@ -788,40 +662,9 @@ export const SubscriptionsAcknowledgedNotificationSchema = v.object({
788
662
  }),
789
663
  });
790
664
 
791
- /**
792
- * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
793
- */
794
- export const SubscribeRequestSchema = v.object({
795
- ...RequestSchema.entries,
796
- method: v.literal('resources/subscribe'),
797
- params: v.object({
798
- ...BaseRequestParamsSchema.entries,
799
-
800
- /**
801
- * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
802
- */
803
- uri: v.string(),
804
- }),
805
- });
806
-
807
- /**
808
- * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
809
- */
810
- export const UnsubscribeRequestSchema = v.object({
811
- ...RequestSchema.entries,
812
- method: v.literal('resources/unsubscribe'),
813
- params: v.object({
814
- ...BaseRequestParamsSchema.entries,
815
-
816
- /**
817
- * The URI of the resource to unsubscribe from.
818
- */
819
- uri: v.string(),
820
- }),
821
- });
822
-
823
665
  /**
824
666
  * 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.
667
+ * @internal
825
668
  */
826
669
  export const ResourceUpdatedNotificationSchema = v.object({
827
670
  ...NotificationSchema.entries,
@@ -840,7 +683,7 @@ export const ResourceUpdatedNotificationSchema = v.object({
840
683
  /**
841
684
  * Describes an argument that a prompt can accept.
842
685
  */
843
- export const PromptArgumentSchema = v.object({
686
+ const PromptArgumentSchema = v.object({
844
687
  /**
845
688
  * The name of the argument.
846
689
  */
@@ -860,7 +703,7 @@ export const PromptArgumentSchema = v.object({
860
703
  /**
861
704
  * A prompt or prompt template that the server offers.
862
705
  */
863
- export const PromptSchema = v.object({
706
+ const PromptSchema = v.object({
864
707
  ...BaseMetadataSchema.entries,
865
708
 
866
709
  /**
@@ -881,47 +724,18 @@ export const PromptSchema = v.object({
881
724
  ...IconsSchema.entries,
882
725
  });
883
726
 
884
- /**
885
- * Sent from the client to request a list of prompts and prompt templates the server has.
886
- */
887
- export const ListPromptsRequestSchema = v.object({
888
- ...PaginatedRequestSchema.entries,
889
- method: v.literal('prompts/list'),
890
- });
891
-
892
727
  /**
893
728
  * The server's response to a prompts/list request from the client.
894
729
  */
895
- export const ListPromptsResultSchema = v.object({
730
+ const ListPromptsResultSchema = v.object({
896
731
  ...PaginatedResultSchema.entries,
897
732
  prompts: v.array(PromptSchema),
898
733
  });
899
734
 
900
- /**
901
- * Used by the client to get a prompt provided by the server.
902
- */
903
- export const GetPromptRequestSchema = v.object({
904
- ...RequestSchema.entries,
905
- method: v.literal('prompts/get'),
906
- params: v.object({
907
- ...BaseRequestParamsSchema.entries,
908
-
909
- /**
910
- * The name of the prompt or prompt template.
911
- */
912
- name: v.string(),
913
-
914
- /**
915
- * Arguments to use for templating the prompt.
916
- */
917
- arguments: v.optional(v.record(v.string(), v.string())),
918
- }),
919
- });
920
-
921
735
  /**
922
736
  * Text provided to or from an LLM.
923
737
  */
924
- export const TextContentSchema = v.object({
738
+ const TextContentSchema = v.object({
925
739
  type: v.literal('text'),
926
740
 
927
741
  /**
@@ -939,7 +753,7 @@ export const TextContentSchema = v.object({
939
753
  /**
940
754
  * An image provided to or from an LLM.
941
755
  */
942
- export const ImageContentSchema = v.object({
756
+ const ImageContentSchema = v.object({
943
757
  type: v.literal('image'),
944
758
 
945
759
  /**
@@ -962,7 +776,7 @@ export const ImageContentSchema = v.object({
962
776
  /**
963
777
  * An Audio provided to or from an LLM.
964
778
  */
965
- export const AudioContentSchema = v.object({
779
+ const AudioContentSchema = v.object({
966
780
  type: v.literal('audio'),
967
781
 
968
782
  /**
@@ -985,7 +799,7 @@ export const AudioContentSchema = v.object({
985
799
  /**
986
800
  * The contents of a resource, embedded into a prompt or tool call result.
987
801
  */
988
- export const EmbeddedResourceSchema = v.object({
802
+ const EmbeddedResourceSchema = v.object({
989
803
  type: v.literal('resource'),
990
804
  resource: v.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
991
805
 
@@ -1001,7 +815,7 @@ export const EmbeddedResourceSchema = v.object({
1001
815
  *
1002
816
  * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
1003
817
  */
1004
- export const ResourceLinkSchema = v.object({
818
+ const ResourceLinkSchema = v.object({
1005
819
  ...ResourceSchema.entries,
1006
820
  type: v.literal('resource_link'),
1007
821
  });
@@ -1009,7 +823,7 @@ export const ResourceLinkSchema = v.object({
1009
823
  /**
1010
824
  * A content block that can be used in prompts and tool results.
1011
825
  */
1012
- export const ContentBlockSchema = v.union([
826
+ const ContentBlockSchema = v.union([
1013
827
  TextContentSchema,
1014
828
  ImageContentSchema,
1015
829
  AudioContentSchema,
@@ -1020,7 +834,7 @@ export const ContentBlockSchema = v.union([
1020
834
  /**
1021
835
  * Describes a message returned as part of a prompt.
1022
836
  */
1023
- export const PromptMessageSchema = v.object({
837
+ const PromptMessageSchema = v.object({
1024
838
  role: v.picklist(['user', 'assistant']),
1025
839
  content: ContentBlockSchema,
1026
840
  });
@@ -1040,6 +854,7 @@ export const GetPromptResultSchema = v.looseObject({
1040
854
 
1041
855
  /**
1042
856
  * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
857
+ * @internal
1043
858
  */
1044
859
  export const PromptListChangedNotificationSchema = v.object({
1045
860
  ...NotificationSchema.entries,
@@ -1058,7 +873,7 @@ export const PromptListChangedNotificationSchema = v.object({
1058
873
  * Clients should never make tool use decisions based on ToolAnnotations
1059
874
  * received from untrusted servers.
1060
875
  */
1061
- export const ToolAnnotationsSchema = v.object({
876
+ const ToolAnnotationsSchema = v.object({
1062
877
  /**
1063
878
  * A human-readable title for the tool.
1064
879
  */
@@ -1105,7 +920,7 @@ export const ToolAnnotationsSchema = v.object({
1105
920
  /**
1106
921
  * Definition for a tool the client can call.
1107
922
  */
1108
- export const ToolSchema = v.object({
923
+ const ToolSchema = v.object({
1109
924
  ...BaseMetadataSchema.entries,
1110
925
 
1111
926
  /**
@@ -1145,18 +960,10 @@ export const ToolSchema = v.object({
1145
960
  ...IconsSchema.entries,
1146
961
  });
1147
962
 
1148
- /**
1149
- * Sent from the client to request a list of tools the server has.
1150
- */
1151
- export const ListToolsRequestSchema = v.object({
1152
- ...PaginatedRequestSchema.entries,
1153
- method: v.literal('tools/list'),
1154
- });
1155
-
1156
963
  /**
1157
964
  * The server's response to a tools/list request from the client.
1158
965
  */
1159
- export const ListToolsResultSchema = v.object({
966
+ const ListToolsResultSchema = v.object({
1160
967
  ...PaginatedResultSchema.entries,
1161
968
  tools: v.array(ToolSchema),
1162
969
  });
@@ -1199,84 +1006,21 @@ export const CallToolResultSchema = v.looseObject({
1199
1006
  isError: v.optional(v.boolean()),
1200
1007
  });
1201
1008
 
1202
- /**
1203
- * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
1204
- */
1205
- export const CompatibilityCallToolResultSchema = v.union([
1206
- CallToolResultSchema,
1207
- v.object({ ...ResultSchema.entries, toolResult: v.unknown() }),
1208
- ]);
1209
-
1210
- /**
1211
- * Used by the client to invoke a tool provided by the server.
1212
- */
1213
- export const CallToolRequestSchema = v.object({
1214
- ...RequestSchema.entries,
1215
- method: v.literal('tools/call'),
1216
- params: v.object({
1217
- ...BaseRequestParamsSchema.entries,
1218
- name: v.string(),
1219
- arguments: v.optional(v.record(v.string(), v.unknown())),
1220
- }),
1221
- });
1222
-
1223
1009
  /**
1224
1010
  * 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.
1011
+ * @internal
1225
1012
  */
1226
1013
  export const ToolListChangedNotificationSchema = v.object({
1227
1014
  ...NotificationSchema.entries,
1228
1015
  method: v.literal('notifications/tools/list_changed'),
1229
1016
  params: v.optional(SubscriptionNotificationParamsSchema),
1230
1017
  });
1231
- /* Logging */
1232
-
1233
- /**
1234
- * A request from the client to the server, to enable or adjust logging.
1235
- */
1236
- export const SetLevelRequestSchema = v.object({
1237
- ...RequestSchema.entries,
1238
- method: v.literal('logging/setLevel'),
1239
- params: v.object({
1240
- ...BaseRequestParamsSchema.entries,
1241
-
1242
- /**
1243
- * 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/logging/message.
1244
- */
1245
- level: LoggingLevelSchema,
1246
- }),
1247
- });
1248
-
1249
- /**
1250
- * Notification of a log message passed from server to client. Per-request clients opt in through `io.modelcontextprotocol/logLevel`; session-negotiated clients use `logging/setLevel` or the server default.
1251
- */
1252
- export const LoggingMessageNotificationSchema = v.object({
1253
- ...NotificationSchema.entries,
1254
- method: v.literal('notifications/message'),
1255
- params: v.object({
1256
- ...BaseNotificationParamsSchema.entries,
1257
-
1258
- /**
1259
- * The severity of this log message.
1260
- */
1261
- level: LoggingLevelSchema,
1262
-
1263
- /**
1264
- * An optional name of the logger issuing this message.
1265
- */
1266
- logger: v.optional(v.string()),
1267
-
1268
- /**
1269
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
1270
- */
1271
- data: v.unknown(),
1272
- }),
1273
- });
1274
1018
  /* Sampling */
1275
1019
 
1276
1020
  /**
1277
1021
  * Hints to use for model selection.
1278
1022
  */
1279
- export const ModelHintSchema = v.object({
1023
+ const ModelHintSchema = v.object({
1280
1024
  /**
1281
1025
  * A hint for a model name.
1282
1026
  */
@@ -1286,7 +1030,7 @@ export const ModelHintSchema = v.object({
1286
1030
  /**
1287
1031
  * The server's preferences for model selection, requested of the client during sampling.
1288
1032
  */
1289
- export const ModelPreferencesSchema = v.object({
1033
+ const ModelPreferencesSchema = v.object({
1290
1034
  /**
1291
1035
  * Optional hints to use for model selection.
1292
1036
  */
@@ -1313,7 +1057,7 @@ export const ModelPreferencesSchema = v.object({
1313
1057
  /**
1314
1058
  * Describes a message issued to or received from an LLM API.
1315
1059
  */
1316
- export const SamplingMessageSchema = v.object({
1060
+ const SamplingMessageSchema = v.object({
1317
1061
  role: v.picklist(['user', 'assistant']),
1318
1062
  content: v.union([
1319
1063
  TextContentSchema,
@@ -1359,7 +1103,7 @@ export const CreateMessageRequestParamsSchema = v.object({
1359
1103
  /**
1360
1104
  * 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.
1361
1105
  */
1362
- export const CreateMessageRequestSchema = v.object({
1106
+ const CreateMessageRequestSchema = v.object({
1363
1107
  ...RequestSchema.entries,
1364
1108
  method: v.literal('sampling/createMessage'),
1365
1109
  params: CreateMessageRequestParamsSchema,
@@ -1397,7 +1141,7 @@ export const CreateMessageResultSchema = v.object({
1397
1141
  /**
1398
1142
  * Primitive schema definition for boolean fields.
1399
1143
  */
1400
- export const BooleanSchemaSchema = v.object({
1144
+ const BooleanSchemaSchema = v.object({
1401
1145
  type: v.literal('boolean'),
1402
1146
  title: v.optional(v.string()),
1403
1147
  description: v.optional(v.string()),
@@ -1407,7 +1151,7 @@ export const BooleanSchemaSchema = v.object({
1407
1151
  /**
1408
1152
  * Primitive schema definition for string fields.
1409
1153
  */
1410
- export const StringSchemaSchema = v.object({
1154
+ const StringSchemaSchema = v.object({
1411
1155
  type: v.literal('string'),
1412
1156
  title: v.optional(v.string()),
1413
1157
  description: v.optional(v.string()),
@@ -1420,7 +1164,7 @@ export const StringSchemaSchema = v.object({
1420
1164
  /**
1421
1165
  * Primitive schema definition for number fields.
1422
1166
  */
1423
- export const NumberSchemaSchema = v.object({
1167
+ const NumberSchemaSchema = v.object({
1424
1168
  type: v.picklist(['number', 'integer']),
1425
1169
  title: v.optional(v.string()),
1426
1170
  description: v.optional(v.string()),
@@ -1490,7 +1234,7 @@ const LegacyTitledEnumSchema = v.object({
1490
1234
  /**
1491
1235
  * Schema definition for single- and multi-select enum fields.
1492
1236
  */
1493
- export const EnumSchemaSchema = v.union([
1237
+ const EnumSchemaSchema = v.union([
1494
1238
  LegacyTitledEnumSchema,
1495
1239
  UntitledSingleSelectEnumSchema,
1496
1240
  TitledSingleSelectEnumSchema,
@@ -1501,7 +1245,7 @@ export const EnumSchemaSchema = v.union([
1501
1245
  /**
1502
1246
  * Union of all primitive schema definitions.
1503
1247
  */
1504
- export const PrimitiveSchemaDefinitionSchema = v.union([
1248
+ const PrimitiveSchemaDefinitionSchema = v.union([
1505
1249
  BooleanSchemaSchema,
1506
1250
  NumberSchemaSchema,
1507
1251
  EnumSchemaSchema,
@@ -1539,6 +1283,7 @@ const ElicitRequestURLParamsSchema = v.object({
1539
1283
  url: v.pipe(v.string(), v.url()),
1540
1284
  });
1541
1285
 
1286
+ /** @internal */
1542
1287
  export const ElicitRequestSchema = v.object({
1543
1288
  ...RequestSchema.entries,
1544
1289
  method: v.literal('elicitation/create'),
@@ -1564,71 +1309,6 @@ export const ElicitResultSchema = v.object({
1564
1309
  */
1565
1310
  content: v.optional(v.record(v.string(), v.unknown())),
1566
1311
  });
1567
- /* Autocomplete */
1568
-
1569
- /**
1570
- * A reference to a resource or resource template definition.
1571
- */
1572
- export const ResourceTemplateReferenceSchema = v.object({
1573
- type: v.literal('ref/resource'),
1574
-
1575
- /**
1576
- * The URI or URI template of the resource.
1577
- */
1578
- uri: v.string(),
1579
- });
1580
-
1581
- /**
1582
- * @deprecated Use ResourceTemplateReferenceSchema instead
1583
- */
1584
- export const ResourceReferenceSchema = ResourceTemplateReferenceSchema;
1585
-
1586
- /**
1587
- * Identifies a prompt.
1588
- */
1589
- export const PromptReferenceSchema = v.object({
1590
- type: v.literal('ref/prompt'),
1591
-
1592
- /**
1593
- * The name of the prompt or prompt template
1594
- */
1595
- name: v.string(),
1596
- });
1597
-
1598
- /**
1599
- * A request from the client to the server, to ask for completion options.
1600
- */
1601
- export const CompleteRequestSchema = v.object({
1602
- ...RequestSchema.entries,
1603
- method: v.literal('completion/complete'),
1604
- params: v.object({
1605
- ...BaseRequestParamsSchema.entries,
1606
- ref: v.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
1607
-
1608
- /**
1609
- * The argument's information
1610
- */
1611
- argument: v.object({
1612
- /**
1613
- * The name of the argument
1614
- */
1615
- name: v.string(),
1616
-
1617
- /**
1618
- * The value of the argument to use for completion matching.
1619
- */
1620
- value: v.string(),
1621
- }),
1622
- context: v.optional(
1623
- v.object({
1624
- /**
1625
- * Previously-resolved variables in a URI template or prompt.
1626
- */
1627
- arguments: v.optional(v.record(v.string(), v.string())),
1628
- }),
1629
- ),
1630
- }),
1631
- });
1632
1312
 
1633
1313
  /**
1634
1314
  * The server's response to a completion/complete request
@@ -1652,52 +1332,14 @@ export const CompleteResultSchema = v.looseObject({
1652
1332
  hasMore: v.optional(v.boolean()),
1653
1333
  }),
1654
1334
  });
1655
- /* Roots */
1656
-
1657
- /**
1658
- * Represents a root directory or file that the server can operate on.
1659
- */
1660
- export const RootSchema = v.object({
1661
- /**
1662
- * The URI identifying the root. This *must* start with file:// for now.
1663
- */
1664
- uri: v.pipe(v.string(), v.startsWith('file://')),
1665
-
1666
- /**
1667
- * An optional name for the root.
1668
- */
1669
- name: v.optional(v.string()),
1670
-
1671
- /**
1672
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
1673
- * for notes on _meta usage.
1674
- */
1675
- _meta: v.optional(v.looseObject({})),
1676
- });
1677
1335
 
1678
1336
  /**
1679
1337
  * Sent from the server to request a list of root URIs from the client.
1680
1338
  */
1681
- export const ListRootsRequestSchema = v.object({
1339
+ const ListRootsRequestSchema = v.object({
1682
1340
  ...RequestSchema.entries,
1683
1341
  method: v.literal('roots/list'),
1684
1342
  });
1685
-
1686
- /**
1687
- * The client's response to a roots/list request from the server.
1688
- */
1689
- export const ListRootsResultSchema = v.object({
1690
- ...ResultSchema.entries,
1691
- roots: v.array(RootSchema),
1692
- });
1693
-
1694
- /**
1695
- * A notification from the client to the server, informing it that the list of roots has changed.
1696
- */
1697
- export const RootsListChangedNotificationSchema = v.object({
1698
- ...NotificationSchema.entries,
1699
- method: v.literal('notifications/roots/list_changed'),
1700
- });
1701
1343
  /* Asking the client for input before finishing a request. */
1702
1344
 
1703
1345
  /**
@@ -1705,7 +1347,7 @@ export const RootsListChangedNotificationSchema = v.object({
1705
1347
  * request. MCP includes `roots/list` here, but tmcp never asks for roots this
1706
1348
  * way.
1707
1349
  */
1708
- export const InputRequestSchema = v.union([
1350
+ const InputRequestSchema = v.union([
1709
1351
  ElicitRequestSchema,
1710
1352
  CreateMessageRequestSchema,
1711
1353
  ListRootsRequestSchema,
@@ -1714,7 +1356,7 @@ export const InputRequestSchema = v.union([
1714
1356
  /**
1715
1357
  * Questions or tasks the client must complete, stored by name.
1716
1358
  */
1717
- export const InputRequestsSchema = v.record(v.string(), InputRequestSchema);
1359
+ const InputRequestsSchema = v.record(v.string(), InputRequestSchema);
1718
1360
 
1719
1361
  /**
1720
1362
  * Answers returned by the client. Each name matches one from `inputRequests`.
@@ -1752,52 +1394,7 @@ export const InputRequiredResultSchema = v.pipe(
1752
1394
  'InputRequiredResult requires inputRequests or requestState',
1753
1395
  ),
1754
1396
  );
1755
- /* Client messages */
1756
- export const ClientRequestSchema = v.union([
1757
- PingRequestSchema,
1758
- InitializeRequestSchema,
1759
- CompleteRequestSchema,
1760
- SetLevelRequestSchema,
1761
- GetPromptRequestSchema,
1762
- ListPromptsRequestSchema,
1763
- ListResourcesRequestSchema,
1764
- ListResourceTemplatesRequestSchema,
1765
- ReadResourceRequestSchema,
1766
- SubscriptionsListenRequestSchema,
1767
- SubscribeRequestSchema,
1768
- UnsubscribeRequestSchema,
1769
- CallToolRequestSchema,
1770
- ListToolsRequestSchema,
1771
- ]);
1772
- export const ClientNotificationSchema = v.union([
1773
- CancelledNotificationSchema,
1774
- ProgressNotificationSchema,
1775
- InitializedNotificationSchema,
1776
- RootsListChangedNotificationSchema,
1777
- ]);
1778
- export const ClientResultSchema = v.union([
1779
- EmptyResultSchema,
1780
- CreateMessageResultSchema,
1781
- ElicitResultSchema,
1782
- ListRootsResultSchema,
1783
- ]);
1784
- /* Server messages */
1785
- export const ServerRequestSchema = v.union([
1786
- PingRequestSchema,
1787
- CreateMessageRequestSchema,
1788
- ElicitRequestSchema,
1789
- ListRootsRequestSchema,
1790
- ]);
1791
- export const ServerNotificationSchema = v.union([
1792
- CancelledNotificationSchema,
1793
- ProgressNotificationSchema,
1794
- LoggingMessageNotificationSchema,
1795
- SubscriptionsAcknowledgedNotificationSchema,
1796
- ResourceUpdatedNotificationSchema,
1797
- ResourceListChangedNotificationSchema,
1798
- ToolListChangedNotificationSchema,
1799
- PromptListChangedNotificationSchema,
1800
- ]);
1397
+ /** @internal */
1801
1398
  export const ServerResultSchema = v.pipe(
1802
1399
  v.union([
1803
1400
  InputRequiredResultSchema,