@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
package/dist/cjs/types.js CHANGED
@@ -1,14 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResourceListChangedNotificationSchema = exports.ReadResourceResultSchema = exports.ReadResourceRequestSchema = exports.ListResourceTemplatesResultSchema = exports.ListResourceTemplatesRequestSchema = exports.ListResourcesResultSchema = exports.ListResourcesRequestSchema = exports.ResourceTemplateSchema = exports.ResourceSchema = exports.BlobResourceContentsSchema = exports.TextResourceContentsSchema = exports.ResourceContentsSchema = exports.PaginatedResultSchema = exports.PaginatedRequestSchema = exports.ProgressNotificationSchema = exports.ProgressSchema = exports.PingRequestSchema = exports.isInitializedNotification = exports.InitializedNotificationSchema = exports.InitializeResultSchema = exports.ServerCapabilitiesSchema = exports.isInitializeRequest = exports.InitializeRequestSchema = exports.ClientCapabilitiesSchema = exports.ImplementationSchema = exports.BaseMetadataSchema = exports.IconsSchema = exports.IconSchema = exports.CancelledNotificationSchema = exports.EmptyResultSchema = exports.JSONRPCMessageSchema = exports.isJSONRPCError = exports.JSONRPCErrorSchema = exports.ErrorCode = exports.isJSONRPCResponse = exports.JSONRPCResponseSchema = exports.isJSONRPCNotification = exports.JSONRPCNotificationSchema = exports.isJSONRPCRequest = exports.JSONRPCRequestSchema = exports.RequestIdSchema = exports.ResultSchema = exports.NotificationSchema = exports.RequestSchema = exports.CursorSchema = exports.ProgressTokenSchema = exports.JSONRPC_VERSION = exports.SUPPORTED_PROTOCOL_VERSIONS = exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION = exports.LATEST_PROTOCOL_VERSION = void 0;
4
- exports.ClientRequestSchema = exports.RootsListChangedNotificationSchema = exports.ListRootsResultSchema = exports.ListRootsRequestSchema = exports.RootSchema = exports.CompleteResultSchema = exports.CompleteRequestSchema = exports.PromptReferenceSchema = exports.ResourceReferenceSchema = exports.ResourceTemplateReferenceSchema = exports.ElicitResultSchema = exports.ElicitRequestSchema = exports.PrimitiveSchemaDefinitionSchema = exports.EnumSchemaSchema = exports.NumberSchemaSchema = exports.StringSchemaSchema = exports.BooleanSchemaSchema = exports.CreateMessageResultSchema = exports.CreateMessageRequestSchema = exports.SamplingMessageSchema = exports.ModelPreferencesSchema = exports.ModelHintSchema = exports.LoggingMessageNotificationSchema = exports.SetLevelRequestSchema = exports.LoggingLevelSchema = exports.ToolListChangedNotificationSchema = exports.CallToolRequestSchema = exports.CompatibilityCallToolResultSchema = exports.CallToolResultSchema = exports.ListToolsResultSchema = exports.ListToolsRequestSchema = exports.ToolSchema = exports.ToolAnnotationsSchema = exports.PromptListChangedNotificationSchema = exports.GetPromptResultSchema = exports.PromptMessageSchema = exports.ContentBlockSchema = exports.ResourceLinkSchema = exports.EmbeddedResourceSchema = exports.AudioContentSchema = exports.ImageContentSchema = exports.TextContentSchema = exports.GetPromptRequestSchema = exports.ListPromptsResultSchema = exports.ListPromptsRequestSchema = exports.PromptSchema = exports.PromptArgumentSchema = exports.ResourceUpdatedNotificationSchema = exports.UnsubscribeRequestSchema = exports.SubscribeRequestSchema = void 0;
5
- exports.McpError = exports.ServerResultSchema = exports.ServerNotificationSchema = exports.ServerRequestSchema = exports.ClientResultSchema = exports.ClientNotificationSchema = void 0;
3
+ exports.ListResourceTemplatesRequestSchema = exports.ListResourcesResultSchema = exports.ListResourcesRequestSchema = exports.ResourceTemplateSchema = exports.ResourceSchema = exports.BlobResourceContentsSchema = exports.TextResourceContentsSchema = exports.ResourceContentsSchema = exports.PaginatedResultSchema = exports.PaginatedRequestSchema = exports.PaginatedRequestParamsSchema = exports.ProgressNotificationSchema = exports.ProgressNotificationParamsSchema = exports.ProgressSchema = exports.PingRequestSchema = exports.isInitializedNotification = exports.InitializedNotificationSchema = exports.InitializeResultSchema = exports.ServerCapabilitiesSchema = exports.isInitializeRequest = exports.InitializeRequestSchema = exports.InitializeRequestParamsSchema = exports.ClientCapabilitiesSchema = exports.ImplementationSchema = exports.BaseMetadataSchema = exports.IconsSchema = exports.IconSchema = exports.CancelledNotificationSchema = exports.CancelledNotificationParamsSchema = exports.EmptyResultSchema = exports.JSONRPCMessageSchema = exports.isJSONRPCError = exports.JSONRPCErrorSchema = exports.ErrorCode = exports.isJSONRPCResponse = exports.JSONRPCResponseSchema = exports.isJSONRPCNotification = exports.JSONRPCNotificationSchema = exports.isJSONRPCRequest = exports.JSONRPCRequestSchema = exports.RequestIdSchema = exports.ResultSchema = exports.NotificationSchema = exports.RequestSchema = exports.CursorSchema = exports.ProgressTokenSchema = exports.JSONRPC_VERSION = exports.SUPPORTED_PROTOCOL_VERSIONS = exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION = exports.LATEST_PROTOCOL_VERSION = void 0;
4
+ exports.NumberSchemaSchema = exports.StringSchemaSchema = exports.BooleanSchemaSchema = exports.CreateMessageResultSchema = exports.CreateMessageRequestSchema = exports.CreateMessageRequestParamsSchema = exports.SamplingMessageSchema = exports.ModelPreferencesSchema = exports.ModelHintSchema = exports.LoggingMessageNotificationSchema = exports.LoggingMessageNotificationParamsSchema = exports.SetLevelRequestSchema = exports.SetLevelRequestParamsSchema = exports.LoggingLevelSchema = exports.ToolListChangedNotificationSchema = exports.CallToolRequestSchema = exports.CallToolRequestParamsSchema = exports.CompatibilityCallToolResultSchema = exports.CallToolResultSchema = exports.ListToolsResultSchema = exports.ListToolsRequestSchema = exports.ToolSchema = exports.ToolAnnotationsSchema = exports.PromptListChangedNotificationSchema = exports.GetPromptResultSchema = exports.PromptMessageSchema = exports.ContentBlockSchema = exports.ResourceLinkSchema = exports.EmbeddedResourceSchema = exports.AudioContentSchema = exports.ImageContentSchema = exports.TextContentSchema = exports.GetPromptRequestSchema = exports.GetPromptRequestParamsSchema = exports.ListPromptsResultSchema = exports.ListPromptsRequestSchema = exports.PromptSchema = exports.PromptArgumentSchema = exports.ResourceUpdatedNotificationSchema = exports.ResourceUpdatedNotificationParamsSchema = exports.UnsubscribeRequestSchema = exports.UnsubscribeRequestParamsSchema = exports.SubscribeRequestSchema = exports.SubscribeRequestParamsSchema = exports.ResourceListChangedNotificationSchema = exports.ReadResourceResultSchema = exports.ReadResourceRequestSchema = exports.ReadResourceRequestParamsSchema = exports.ResourceRequestParamsSchema = exports.ListResourceTemplatesResultSchema = void 0;
5
+ exports.McpError = exports.ServerResultSchema = exports.ServerNotificationSchema = exports.ServerRequestSchema = exports.ClientResultSchema = exports.ClientNotificationSchema = exports.ClientRequestSchema = exports.RootsListChangedNotificationSchema = exports.ListRootsResultSchema = exports.ListRootsRequestSchema = exports.RootSchema = exports.CompleteResultSchema = exports.CompleteRequestSchema = exports.CompleteRequestParamsSchema = exports.PromptReferenceSchema = exports.ResourceReferenceSchema = exports.ResourceTemplateReferenceSchema = exports.ElicitResultSchema = exports.ElicitRequestSchema = exports.ElicitRequestParamsSchema = exports.PrimitiveSchemaDefinitionSchema = exports.EnumSchemaSchema = exports.MultiSelectEnumSchemaSchema = exports.TitledMultiSelectEnumSchemaSchema = exports.UntitledMultiSelectEnumSchemaSchema = exports.SingleSelectEnumSchemaSchema = exports.LegacyTitledEnumSchemaSchema = exports.TitledSingleSelectEnumSchemaSchema = exports.UntitledSingleSelectEnumSchemaSchema = void 0;
6
+ exports.assertCompleteRequestPrompt = assertCompleteRequestPrompt;
7
+ exports.assertCompleteRequestResourceTemplate = assertCompleteRequestResourceTemplate;
6
8
  const zod_1 = require("zod");
7
9
  exports.LATEST_PROTOCOL_VERSION = '2025-06-18';
8
10
  exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';
9
11
  exports.SUPPORTED_PROTOCOL_VERSIONS = [exports.LATEST_PROTOCOL_VERSION, '2025-03-26', '2024-11-05', '2024-10-07'];
10
12
  /* JSON-RPC types */
11
13
  exports.JSONRPC_VERSION = '2.0';
14
+ /**
15
+ * Assert 'object' type schema.
16
+ *
17
+ * @internal
18
+ */
19
+ const AssertObjectSchema = zod_1.z.custom((v) => v !== null && (typeof v === 'object' || typeof v === 'function'));
12
20
  /**
13
21
  * A progress token, used to associate progress notifications with the original request.
14
22
  */
@@ -22,30 +30,35 @@ const RequestMetaSchema = zod_1.z
22
30
  /**
23
31
  * 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.
24
32
  */
25
- progressToken: zod_1.z.optional(exports.ProgressTokenSchema)
26
- })
27
- .passthrough();
28
- const BaseRequestParamsSchema = zod_1.z
29
- .object({
30
- _meta: zod_1.z.optional(RequestMetaSchema)
33
+ progressToken: exports.ProgressTokenSchema.optional()
31
34
  })
35
+ /**
36
+ * Passthrough required here because we want to allow any additional fields to be added to the request meta.
37
+ */
32
38
  .passthrough();
39
+ /**
40
+ * Common params for any request.
41
+ */
42
+ const BaseRequestParamsSchema = zod_1.z.object({
43
+ /**
44
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
45
+ */
46
+ _meta: RequestMetaSchema.optional()
47
+ });
33
48
  exports.RequestSchema = zod_1.z.object({
34
49
  method: zod_1.z.string(),
35
- params: zod_1.z.optional(BaseRequestParamsSchema)
50
+ params: BaseRequestParamsSchema.passthrough().optional()
36
51
  });
37
- const BaseNotificationParamsSchema = zod_1.z
38
- .object({
52
+ const NotificationsParamsSchema = zod_1.z.object({
39
53
  /**
40
54
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
41
55
  * for notes on _meta usage.
42
56
  */
43
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
44
- })
45
- .passthrough();
57
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
58
+ });
46
59
  exports.NotificationSchema = zod_1.z.object({
47
60
  method: zod_1.z.string(),
48
- params: zod_1.z.optional(BaseNotificationParamsSchema)
61
+ params: NotificationsParamsSchema.passthrough().optional()
49
62
  });
50
63
  exports.ResultSchema = zod_1.z
51
64
  .object({
@@ -53,8 +66,11 @@ exports.ResultSchema = zod_1.z
53
66
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
54
67
  * for notes on _meta usage.
55
68
  */
56
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
69
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
57
70
  })
71
+ /**
72
+ * Passthrough required here because we want to allow any additional fields to be added to the result.
73
+ */
58
74
  .passthrough();
59
75
  /**
60
76
  * A uniquely identifying ID for a request in JSON-RPC.
@@ -141,6 +157,18 @@ exports.JSONRPCMessageSchema = zod_1.z.union([exports.JSONRPCRequestSchema, expo
141
157
  * A response that indicates success but carries no data.
142
158
  */
143
159
  exports.EmptyResultSchema = exports.ResultSchema.strict();
160
+ exports.CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
161
+ /**
162
+ * The ID of the request to cancel.
163
+ *
164
+ * This MUST correspond to the ID of a request previously issued in the same direction.
165
+ */
166
+ requestId: exports.RequestIdSchema,
167
+ /**
168
+ * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
169
+ */
170
+ reason: zod_1.z.string().optional()
171
+ });
144
172
  /* Cancellation */
145
173
  /**
146
174
  * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
@@ -153,25 +181,13 @@ exports.EmptyResultSchema = exports.ResultSchema.strict();
153
181
  */
154
182
  exports.CancelledNotificationSchema = exports.NotificationSchema.extend({
155
183
  method: zod_1.z.literal('notifications/cancelled'),
156
- params: BaseNotificationParamsSchema.extend({
157
- /**
158
- * The ID of the request to cancel.
159
- *
160
- * This MUST correspond to the ID of a request previously issued in the same direction.
161
- */
162
- requestId: exports.RequestIdSchema,
163
- /**
164
- * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
165
- */
166
- reason: zod_1.z.string().optional()
167
- })
184
+ params: exports.CancelledNotificationParamsSchema
168
185
  });
169
186
  /* Base Metadata */
170
187
  /**
171
188
  * Icon schema for use in tools, prompts, resources, and implementations.
172
189
  */
173
- exports.IconSchema = zod_1.z
174
- .object({
190
+ exports.IconSchema = zod_1.z.object({
175
191
  /**
176
192
  * URL or data URI for the icon.
177
193
  */
@@ -179,22 +195,20 @@ exports.IconSchema = zod_1.z
179
195
  /**
180
196
  * Optional MIME type for the icon.
181
197
  */
182
- mimeType: zod_1.z.optional(zod_1.z.string()),
198
+ mimeType: zod_1.z.string().optional(),
183
199
  /**
184
200
  * Optional array of strings that specify sizes at which the icon can be used.
185
201
  * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
186
202
  *
187
203
  * If not provided, the client should assume that the icon can be used at any size.
188
204
  */
189
- sizes: zod_1.z.optional(zod_1.z.array(zod_1.z.string()))
190
- })
191
- .passthrough();
205
+ sizes: zod_1.z.array(zod_1.z.string()).optional()
206
+ });
192
207
  /**
193
208
  * Base schema to add `icons` property.
194
209
  *
195
210
  */
196
- exports.IconsSchema = zod_1.z
197
- .object({
211
+ exports.IconsSchema = zod_1.z.object({
198
212
  /**
199
213
  * Optional set of sized icons that the client can display in a user interface.
200
214
  *
@@ -207,13 +221,11 @@ exports.IconsSchema = zod_1.z
207
221
  * - `image/webp` - WebP images (modern, efficient format)
208
222
  */
209
223
  icons: zod_1.z.array(exports.IconSchema).optional()
210
- })
211
- .passthrough();
224
+ });
212
225
  /**
213
226
  * Base metadata interface for common properties across resources, tools, prompts, and implementations.
214
227
  */
215
- exports.BaseMetadataSchema = zod_1.z
216
- .object({
228
+ exports.BaseMetadataSchema = zod_1.z.object({
217
229
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
218
230
  name: zod_1.z.string(),
219
231
  /**
@@ -224,9 +236,8 @@ exports.BaseMetadataSchema = zod_1.z
224
236
  * where `annotations.title` should be given precedence over using `name`,
225
237
  * if present).
226
238
  */
227
- title: zod_1.z.optional(zod_1.z.string())
228
- })
229
- .passthrough();
239
+ title: zod_1.z.string().optional()
240
+ });
230
241
  /* Initialization */
231
242
  /**
232
243
  * Describes the name and version of an MCP implementation.
@@ -236,110 +247,112 @@ exports.ImplementationSchema = exports.BaseMetadataSchema.extend({
236
247
  /**
237
248
  * An optional URL of the website for this implementation.
238
249
  */
239
- websiteUrl: zod_1.z.optional(zod_1.z.string())
250
+ websiteUrl: zod_1.z.string().optional()
240
251
  }).merge(exports.IconsSchema);
241
252
  /**
242
253
  * 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.
243
254
  */
244
- exports.ClientCapabilitiesSchema = zod_1.z
245
- .object({
255
+ exports.ClientCapabilitiesSchema = zod_1.z.object({
246
256
  /**
247
257
  * Experimental, non-standard capabilities that the client supports.
248
258
  */
249
- experimental: zod_1.z.optional(zod_1.z.object({}).passthrough()),
259
+ experimental: zod_1.z.record(zod_1.z.string(), AssertObjectSchema).optional(),
250
260
  /**
251
261
  * Present if the client supports sampling from an LLM.
252
262
  */
253
- sampling: zod_1.z.optional(zod_1.z.object({}).passthrough()),
263
+ sampling: AssertObjectSchema.optional(),
254
264
  /**
255
265
  * Present if the client supports eliciting user input.
256
266
  */
257
- elicitation: zod_1.z.optional(zod_1.z.object({}).passthrough()),
267
+ elicitation: zod_1.z.intersection(zod_1.z
268
+ .object({
269
+ /**
270
+ * Whether the client should apply defaults to the user input.
271
+ */
272
+ applyDefaults: zod_1.z.boolean().optional()
273
+ })
274
+ .optional(), zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()),
258
275
  /**
259
276
  * Present if the client supports listing roots.
260
277
  */
261
- roots: zod_1.z.optional(zod_1.z
278
+ roots: zod_1.z
262
279
  .object({
263
280
  /**
264
281
  * Whether the client supports issuing notifications for changes to the roots list.
265
282
  */
266
- listChanged: zod_1.z.optional(zod_1.z.boolean())
283
+ listChanged: zod_1.z.boolean().optional()
267
284
  })
268
- .passthrough())
269
- })
270
- .passthrough();
285
+ .optional()
286
+ });
287
+ exports.InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
288
+ /**
289
+ * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
290
+ */
291
+ protocolVersion: zod_1.z.string(),
292
+ capabilities: exports.ClientCapabilitiesSchema,
293
+ clientInfo: exports.ImplementationSchema
294
+ });
271
295
  /**
272
296
  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
273
297
  */
274
298
  exports.InitializeRequestSchema = exports.RequestSchema.extend({
275
299
  method: zod_1.z.literal('initialize'),
276
- params: BaseRequestParamsSchema.extend({
277
- /**
278
- * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
279
- */
280
- protocolVersion: zod_1.z.string(),
281
- capabilities: exports.ClientCapabilitiesSchema,
282
- clientInfo: exports.ImplementationSchema
283
- })
300
+ params: exports.InitializeRequestParamsSchema
284
301
  });
285
302
  const isInitializeRequest = (value) => exports.InitializeRequestSchema.safeParse(value).success;
286
303
  exports.isInitializeRequest = isInitializeRequest;
287
304
  /**
288
305
  * 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.
289
306
  */
290
- exports.ServerCapabilitiesSchema = zod_1.z
291
- .object({
307
+ exports.ServerCapabilitiesSchema = zod_1.z.object({
292
308
  /**
293
309
  * Experimental, non-standard capabilities that the server supports.
294
310
  */
295
- experimental: zod_1.z.optional(zod_1.z.object({}).passthrough()),
311
+ experimental: zod_1.z.record(zod_1.z.string(), AssertObjectSchema).optional(),
296
312
  /**
297
313
  * Present if the server supports sending log messages to the client.
298
314
  */
299
- logging: zod_1.z.optional(zod_1.z.object({}).passthrough()),
315
+ logging: AssertObjectSchema.optional(),
300
316
  /**
301
317
  * Present if the server supports sending completions to the client.
302
318
  */
303
- completions: zod_1.z.optional(zod_1.z.object({}).passthrough()),
319
+ completions: AssertObjectSchema.optional(),
304
320
  /**
305
321
  * Present if the server offers any prompt templates.
306
322
  */
307
- prompts: zod_1.z.optional(zod_1.z
308
- .object({
323
+ prompts: zod_1.z.optional(zod_1.z.object({
309
324
  /**
310
325
  * Whether this server supports issuing notifications for changes to the prompt list.
311
326
  */
312
327
  listChanged: zod_1.z.optional(zod_1.z.boolean())
313
- })
314
- .passthrough()),
328
+ })),
315
329
  /**
316
330
  * Present if the server offers any resources to read.
317
331
  */
318
- resources: zod_1.z.optional(zod_1.z
332
+ resources: zod_1.z
319
333
  .object({
320
334
  /**
321
335
  * Whether this server supports clients subscribing to resource updates.
322
336
  */
323
- subscribe: zod_1.z.optional(zod_1.z.boolean()),
337
+ subscribe: zod_1.z.boolean().optional(),
324
338
  /**
325
339
  * Whether this server supports issuing notifications for changes to the resource list.
326
340
  */
327
- listChanged: zod_1.z.optional(zod_1.z.boolean())
341
+ listChanged: zod_1.z.boolean().optional()
328
342
  })
329
- .passthrough()),
343
+ .optional(),
330
344
  /**
331
345
  * Present if the server offers any tools to call.
332
346
  */
333
- tools: zod_1.z.optional(zod_1.z
347
+ tools: zod_1.z
334
348
  .object({
335
349
  /**
336
350
  * Whether this server supports issuing notifications for changes to the tool list.
337
351
  */
338
- listChanged: zod_1.z.optional(zod_1.z.boolean())
352
+ listChanged: zod_1.z.boolean().optional()
339
353
  })
340
- .passthrough())
341
- })
342
- .passthrough();
354
+ .optional()
355
+ });
343
356
  /**
344
357
  * After receiving an initialize request from the client, the server sends this response.
345
358
  */
@@ -355,7 +368,7 @@ exports.InitializeResultSchema = exports.ResultSchema.extend({
355
368
  *
356
369
  * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
357
370
  */
358
- instructions: zod_1.z.optional(zod_1.z.string())
371
+ instructions: zod_1.z.string().optional()
359
372
  });
360
373
  /**
361
374
  * This notification is sent from the client to the server after initialization has finished.
@@ -373,8 +386,7 @@ exports.PingRequestSchema = exports.RequestSchema.extend({
373
386
  method: zod_1.z.literal('ping')
374
387
  });
375
388
  /* Progress notifications */
376
- exports.ProgressSchema = zod_1.z
377
- .object({
389
+ exports.ProgressSchema = zod_1.z.object({
378
390
  /**
379
391
  * The progress thus far. This should increase every time progress is made, even if the total is unknown.
380
392
  */
@@ -387,29 +399,32 @@ exports.ProgressSchema = zod_1.z
387
399
  * An optional message describing the current progress.
388
400
  */
389
401
  message: zod_1.z.optional(zod_1.z.string())
390
- })
391
- .passthrough();
402
+ });
403
+ exports.ProgressNotificationParamsSchema = NotificationsParamsSchema.merge(exports.ProgressSchema).extend({
404
+ /**
405
+ * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
406
+ */
407
+ progressToken: exports.ProgressTokenSchema
408
+ });
392
409
  /**
393
410
  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
411
+ *
412
+ * @category notifications/progress
394
413
  */
395
414
  exports.ProgressNotificationSchema = exports.NotificationSchema.extend({
396
415
  method: zod_1.z.literal('notifications/progress'),
397
- params: BaseNotificationParamsSchema.merge(exports.ProgressSchema).extend({
398
- /**
399
- * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
400
- */
401
- progressToken: exports.ProgressTokenSchema
402
- })
416
+ params: exports.ProgressNotificationParamsSchema
417
+ });
418
+ exports.PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
419
+ /**
420
+ * An opaque token representing the current pagination position.
421
+ * If provided, the server should return results starting after this cursor.
422
+ */
423
+ cursor: exports.CursorSchema.optional()
403
424
  });
404
425
  /* Pagination */
405
426
  exports.PaginatedRequestSchema = exports.RequestSchema.extend({
406
- params: BaseRequestParamsSchema.extend({
407
- /**
408
- * An opaque token representing the current pagination position.
409
- * If provided, the server should return results starting after this cursor.
410
- */
411
- cursor: zod_1.z.optional(exports.CursorSchema)
412
- }).optional()
427
+ params: exports.PaginatedRequestParamsSchema.optional()
413
428
  });
414
429
  exports.PaginatedResultSchema = exports.ResultSchema.extend({
415
430
  /**
@@ -422,8 +437,7 @@ exports.PaginatedResultSchema = exports.ResultSchema.extend({
422
437
  /**
423
438
  * The contents of a specific resource or sub-resource.
424
439
  */
425
- exports.ResourceContentsSchema = zod_1.z
426
- .object({
440
+ exports.ResourceContentsSchema = zod_1.z.object({
427
441
  /**
428
442
  * The URI of this resource.
429
443
  */
@@ -436,9 +450,8 @@ exports.ResourceContentsSchema = zod_1.z
436
450
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
437
451
  * for notes on _meta usage.
438
452
  */
439
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
440
- })
441
- .passthrough();
453
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
454
+ });
442
455
  exports.TextResourceContentsSchema = exports.ResourceContentsSchema.extend({
443
456
  /**
444
457
  * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
@@ -539,17 +552,24 @@ exports.ListResourceTemplatesRequestSchema = exports.PaginatedRequestSchema.exte
539
552
  exports.ListResourceTemplatesResultSchema = exports.PaginatedResultSchema.extend({
540
553
  resourceTemplates: zod_1.z.array(exports.ResourceTemplateSchema)
541
554
  });
555
+ exports.ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
556
+ /**
557
+ * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
558
+ *
559
+ * @format uri
560
+ */
561
+ uri: zod_1.z.string()
562
+ });
563
+ /**
564
+ * Parameters for a `resources/read` request.
565
+ */
566
+ exports.ReadResourceRequestParamsSchema = exports.ResourceRequestParamsSchema;
542
567
  /**
543
568
  * Sent from the client to the server, to read a specific resource URI.
544
569
  */
545
570
  exports.ReadResourceRequestSchema = exports.RequestSchema.extend({
546
571
  method: zod_1.z.literal('resources/read'),
547
- params: BaseRequestParamsSchema.extend({
548
- /**
549
- * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
550
- */
551
- uri: zod_1.z.string()
552
- })
572
+ params: exports.ReadResourceRequestParamsSchema
553
573
  });
554
574
  /**
555
575
  * The server's response to a resources/read request from the client.
@@ -563,48 +583,43 @@ exports.ReadResourceResultSchema = exports.ResultSchema.extend({
563
583
  exports.ResourceListChangedNotificationSchema = exports.NotificationSchema.extend({
564
584
  method: zod_1.z.literal('notifications/resources/list_changed')
565
585
  });
586
+ exports.SubscribeRequestParamsSchema = exports.ResourceRequestParamsSchema;
566
587
  /**
567
588
  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
568
589
  */
569
590
  exports.SubscribeRequestSchema = exports.RequestSchema.extend({
570
591
  method: zod_1.z.literal('resources/subscribe'),
571
- params: BaseRequestParamsSchema.extend({
572
- /**
573
- * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
574
- */
575
- uri: zod_1.z.string()
576
- })
592
+ params: exports.SubscribeRequestParamsSchema
577
593
  });
594
+ exports.UnsubscribeRequestParamsSchema = exports.ResourceRequestParamsSchema;
578
595
  /**
579
596
  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
580
597
  */
581
598
  exports.UnsubscribeRequestSchema = exports.RequestSchema.extend({
582
599
  method: zod_1.z.literal('resources/unsubscribe'),
583
- params: BaseRequestParamsSchema.extend({
584
- /**
585
- * The URI of the resource to unsubscribe from.
586
- */
587
- uri: zod_1.z.string()
588
- })
600
+ params: exports.UnsubscribeRequestParamsSchema
601
+ });
602
+ /**
603
+ * Parameters for a `notifications/resources/updated` notification.
604
+ */
605
+ exports.ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
606
+ /**
607
+ * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
608
+ */
609
+ uri: zod_1.z.string()
589
610
  });
590
611
  /**
591
612
  * 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.
592
613
  */
593
614
  exports.ResourceUpdatedNotificationSchema = exports.NotificationSchema.extend({
594
615
  method: zod_1.z.literal('notifications/resources/updated'),
595
- params: BaseNotificationParamsSchema.extend({
596
- /**
597
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
598
- */
599
- uri: zod_1.z.string()
600
- })
616
+ params: exports.ResourceUpdatedNotificationParamsSchema
601
617
  });
602
618
  /* Prompts */
603
619
  /**
604
620
  * Describes an argument that a prompt can accept.
605
621
  */
606
- exports.PromptArgumentSchema = zod_1.z
607
- .object({
622
+ exports.PromptArgumentSchema = zod_1.z.object({
608
623
  /**
609
624
  * The name of the argument.
610
625
  */
@@ -617,8 +632,7 @@ exports.PromptArgumentSchema = zod_1.z
617
632
  * Whether this argument must be provided.
618
633
  */
619
634
  required: zod_1.z.optional(zod_1.z.boolean())
620
- })
621
- .passthrough();
635
+ });
622
636
  /**
623
637
  * A prompt or prompt template that the server offers.
624
638
  */
@@ -649,27 +663,30 @@ exports.ListPromptsRequestSchema = exports.PaginatedRequestSchema.extend({
649
663
  exports.ListPromptsResultSchema = exports.PaginatedResultSchema.extend({
650
664
  prompts: zod_1.z.array(exports.PromptSchema)
651
665
  });
666
+ /**
667
+ * Parameters for a `prompts/get` request.
668
+ */
669
+ exports.GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
670
+ /**
671
+ * The name of the prompt or prompt template.
672
+ */
673
+ name: zod_1.z.string(),
674
+ /**
675
+ * Arguments to use for templating the prompt.
676
+ */
677
+ arguments: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional()
678
+ });
652
679
  /**
653
680
  * Used by the client to get a prompt provided by the server.
654
681
  */
655
682
  exports.GetPromptRequestSchema = exports.RequestSchema.extend({
656
683
  method: zod_1.z.literal('prompts/get'),
657
- params: BaseRequestParamsSchema.extend({
658
- /**
659
- * The name of the prompt or prompt template.
660
- */
661
- name: zod_1.z.string(),
662
- /**
663
- * Arguments to use for templating the prompt.
664
- */
665
- arguments: zod_1.z.optional(zod_1.z.record(zod_1.z.string()))
666
- })
684
+ params: exports.GetPromptRequestParamsSchema
667
685
  });
668
686
  /**
669
687
  * Text provided to or from an LLM.
670
688
  */
671
- exports.TextContentSchema = zod_1.z
672
- .object({
689
+ exports.TextContentSchema = zod_1.z.object({
673
690
  type: zod_1.z.literal('text'),
674
691
  /**
675
692
  * The text content of the message.
@@ -679,14 +696,12 @@ exports.TextContentSchema = zod_1.z
679
696
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
680
697
  * for notes on _meta usage.
681
698
  */
682
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
683
- })
684
- .passthrough();
699
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
700
+ });
685
701
  /**
686
702
  * An image provided to or from an LLM.
687
703
  */
688
- exports.ImageContentSchema = zod_1.z
689
- .object({
704
+ exports.ImageContentSchema = zod_1.z.object({
690
705
  type: zod_1.z.literal('image'),
691
706
  /**
692
707
  * The base64-encoded image data.
@@ -700,14 +715,12 @@ exports.ImageContentSchema = zod_1.z
700
715
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
701
716
  * for notes on _meta usage.
702
717
  */
703
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
704
- })
705
- .passthrough();
718
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
719
+ });
706
720
  /**
707
721
  * An Audio provided to or from an LLM.
708
722
  */
709
- exports.AudioContentSchema = zod_1.z
710
- .object({
723
+ exports.AudioContentSchema = zod_1.z.object({
711
724
  type: zod_1.z.literal('audio'),
712
725
  /**
713
726
  * The base64-encoded audio data.
@@ -721,23 +734,20 @@ exports.AudioContentSchema = zod_1.z
721
734
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
722
735
  * for notes on _meta usage.
723
736
  */
724
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
725
- })
726
- .passthrough();
737
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
738
+ });
727
739
  /**
728
740
  * The contents of a resource, embedded into a prompt or tool call result.
729
741
  */
730
- exports.EmbeddedResourceSchema = zod_1.z
731
- .object({
742
+ exports.EmbeddedResourceSchema = zod_1.z.object({
732
743
  type: zod_1.z.literal('resource'),
733
744
  resource: zod_1.z.union([exports.TextResourceContentsSchema, exports.BlobResourceContentsSchema]),
734
745
  /**
735
746
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
736
747
  * for notes on _meta usage.
737
748
  */
738
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
739
- })
740
- .passthrough();
749
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
750
+ });
741
751
  /**
742
752
  * A resource that the server is capable of reading, included in a prompt or tool call result.
743
753
  *
@@ -759,12 +769,10 @@ exports.ContentBlockSchema = zod_1.z.union([
759
769
  /**
760
770
  * Describes a message returned as part of a prompt.
761
771
  */
762
- exports.PromptMessageSchema = zod_1.z
763
- .object({
772
+ exports.PromptMessageSchema = zod_1.z.object({
764
773
  role: zod_1.z.enum(['user', 'assistant']),
765
774
  content: exports.ContentBlockSchema
766
- })
767
- .passthrough();
775
+ });
768
776
  /**
769
777
  * The server's response to a prompts/get request from the client.
770
778
  */
@@ -792,18 +800,17 @@ exports.PromptListChangedNotificationSchema = exports.NotificationSchema.extend(
792
800
  * Clients should never make tool use decisions based on ToolAnnotations
793
801
  * received from untrusted servers.
794
802
  */
795
- exports.ToolAnnotationsSchema = zod_1.z
796
- .object({
803
+ exports.ToolAnnotationsSchema = zod_1.z.object({
797
804
  /**
798
805
  * A human-readable title for the tool.
799
806
  */
800
- title: zod_1.z.optional(zod_1.z.string()),
807
+ title: zod_1.z.string().optional(),
801
808
  /**
802
809
  * If true, the tool does not modify its environment.
803
810
  *
804
811
  * Default: false
805
812
  */
806
- readOnlyHint: zod_1.z.optional(zod_1.z.boolean()),
813
+ readOnlyHint: zod_1.z.boolean().optional(),
807
814
  /**
808
815
  * If true, the tool may perform destructive updates to its environment.
809
816
  * If false, the tool performs only additive updates.
@@ -812,7 +819,7 @@ exports.ToolAnnotationsSchema = zod_1.z
812
819
  *
813
820
  * Default: true
814
821
  */
815
- destructiveHint: zod_1.z.optional(zod_1.z.boolean()),
822
+ destructiveHint: zod_1.z.boolean().optional(),
816
823
  /**
817
824
  * If true, calling the tool repeatedly with the same arguments
818
825
  * will have no additional effect on the its environment.
@@ -821,7 +828,7 @@ exports.ToolAnnotationsSchema = zod_1.z
821
828
  *
822
829
  * Default: false
823
830
  */
824
- idempotentHint: zod_1.z.optional(zod_1.z.boolean()),
831
+ idempotentHint: zod_1.z.boolean().optional(),
825
832
  /**
826
833
  * If true, this tool may interact with an "open world" of external
827
834
  * entities. If false, the tool's domain of interaction is closed.
@@ -830,9 +837,8 @@ exports.ToolAnnotationsSchema = zod_1.z
830
837
  *
831
838
  * Default: true
832
839
  */
833
- openWorldHint: zod_1.z.optional(zod_1.z.boolean())
834
- })
835
- .passthrough();
840
+ openWorldHint: zod_1.z.boolean().optional()
841
+ });
836
842
  /**
837
843
  * Definition for a tool the client can call.
838
844
  */
@@ -840,28 +846,30 @@ exports.ToolSchema = exports.BaseMetadataSchema.extend({
840
846
  /**
841
847
  * A human-readable description of the tool.
842
848
  */
843
- description: zod_1.z.optional(zod_1.z.string()),
849
+ description: zod_1.z.string().optional(),
844
850
  /**
845
851
  * A JSON Schema object defining the expected parameters for the tool.
846
852
  */
847
- inputSchema: zod_1.z
848
- .object({
853
+ inputSchema: zod_1.z.object({
849
854
  type: zod_1.z.literal('object'),
850
- properties: zod_1.z.optional(zod_1.z.object({}).passthrough()),
855
+ properties: zod_1.z.record(zod_1.z.string(), AssertObjectSchema).optional(),
851
856
  required: zod_1.z.optional(zod_1.z.array(zod_1.z.string()))
852
- })
853
- .passthrough(),
857
+ }),
854
858
  /**
855
859
  * An optional JSON Schema object defining the structure of the tool's output returned in
856
860
  * the structuredContent field of a CallToolResult.
857
861
  */
858
- outputSchema: zod_1.z.optional(zod_1.z
862
+ outputSchema: zod_1.z
859
863
  .object({
860
864
  type: zod_1.z.literal('object'),
861
- properties: zod_1.z.optional(zod_1.z.object({}).passthrough()),
862
- required: zod_1.z.optional(zod_1.z.array(zod_1.z.string()))
865
+ properties: zod_1.z.record(zod_1.z.string(), AssertObjectSchema).optional(),
866
+ required: zod_1.z.optional(zod_1.z.array(zod_1.z.string())),
867
+ /**
868
+ * Not in the MCP specification, but added to support the Ajv validator while removing .passthrough() which previously allowed additionalProperties to be passed through.
869
+ */
870
+ additionalProperties: zod_1.z.optional(zod_1.z.boolean())
863
871
  })
864
- .passthrough()),
872
+ .optional(),
865
873
  /**
866
874
  * Optional additional tool information.
867
875
  */
@@ -870,7 +878,7 @@ exports.ToolSchema = exports.BaseMetadataSchema.extend({
870
878
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
871
879
  * for notes on _meta usage.
872
880
  */
873
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
881
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
874
882
  }).merge(exports.IconsSchema);
875
883
  /**
876
884
  * Sent from the client to request a list of tools the server has.
@@ -900,7 +908,7 @@ exports.CallToolResultSchema = exports.ResultSchema.extend({
900
908
  *
901
909
  * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
902
910
  */
903
- structuredContent: zod_1.z.object({}).passthrough().optional(),
911
+ structuredContent: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
904
912
  /**
905
913
  * Whether the tool call ended in an error.
906
914
  *
@@ -923,15 +931,25 @@ exports.CallToolResultSchema = exports.ResultSchema.extend({
923
931
  exports.CompatibilityCallToolResultSchema = exports.CallToolResultSchema.or(exports.ResultSchema.extend({
924
932
  toolResult: zod_1.z.unknown()
925
933
  }));
934
+ /**
935
+ * Parameters for a `tools/call` request.
936
+ */
937
+ exports.CallToolRequestParamsSchema = BaseRequestParamsSchema.extend({
938
+ /**
939
+ * The name of the tool to call.
940
+ */
941
+ name: zod_1.z.string(),
942
+ /**
943
+ * Arguments to pass to the tool.
944
+ */
945
+ arguments: zod_1.z.optional(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
946
+ });
926
947
  /**
927
948
  * Used by the client to invoke a tool provided by the server.
928
949
  */
929
950
  exports.CallToolRequestSchema = exports.RequestSchema.extend({
930
951
  method: zod_1.z.literal('tools/call'),
931
- params: BaseRequestParamsSchema.extend({
932
- name: zod_1.z.string(),
933
- arguments: zod_1.z.optional(zod_1.z.record(zod_1.z.unknown()))
934
- })
952
+ params: exports.CallToolRequestParamsSchema
935
953
  });
936
954
  /**
937
955
  * 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.
@@ -944,55 +962,60 @@ exports.ToolListChangedNotificationSchema = exports.NotificationSchema.extend({
944
962
  * The severity of a log message.
945
963
  */
946
964
  exports.LoggingLevelSchema = zod_1.z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']);
965
+ /**
966
+ * Parameters for a `logging/setLevel` request.
967
+ */
968
+ exports.SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
969
+ /**
970
+ * 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.
971
+ */
972
+ level: exports.LoggingLevelSchema
973
+ });
947
974
  /**
948
975
  * A request from the client to the server, to enable or adjust logging.
949
976
  */
950
977
  exports.SetLevelRequestSchema = exports.RequestSchema.extend({
951
978
  method: zod_1.z.literal('logging/setLevel'),
952
- params: BaseRequestParamsSchema.extend({
953
- /**
954
- * 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.
955
- */
956
- level: exports.LoggingLevelSchema
957
- })
979
+ params: exports.SetLevelRequestParamsSchema
980
+ });
981
+ /**
982
+ * Parameters for a `notifications/message` notification.
983
+ */
984
+ exports.LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
985
+ /**
986
+ * The severity of this log message.
987
+ */
988
+ level: exports.LoggingLevelSchema,
989
+ /**
990
+ * An optional name of the logger issuing this message.
991
+ */
992
+ logger: zod_1.z.string().optional(),
993
+ /**
994
+ * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
995
+ */
996
+ data: zod_1.z.unknown()
958
997
  });
959
998
  /**
960
999
  * Notification 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.
961
1000
  */
962
1001
  exports.LoggingMessageNotificationSchema = exports.NotificationSchema.extend({
963
1002
  method: zod_1.z.literal('notifications/message'),
964
- params: BaseNotificationParamsSchema.extend({
965
- /**
966
- * The severity of this log message.
967
- */
968
- level: exports.LoggingLevelSchema,
969
- /**
970
- * An optional name of the logger issuing this message.
971
- */
972
- logger: zod_1.z.optional(zod_1.z.string()),
973
- /**
974
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
975
- */
976
- data: zod_1.z.unknown()
977
- })
1003
+ params: exports.LoggingMessageNotificationParamsSchema
978
1004
  });
979
1005
  /* Sampling */
980
1006
  /**
981
1007
  * Hints to use for model selection.
982
1008
  */
983
- exports.ModelHintSchema = zod_1.z
984
- .object({
1009
+ exports.ModelHintSchema = zod_1.z.object({
985
1010
  /**
986
1011
  * A hint for a model name.
987
1012
  */
988
1013
  name: zod_1.z.string().optional()
989
- })
990
- .passthrough();
1014
+ });
991
1015
  /**
992
1016
  * The server's preferences for model selection, requested of the client during sampling.
993
1017
  */
994
- exports.ModelPreferencesSchema = zod_1.z
995
- .object({
1018
+ exports.ModelPreferencesSchema = zod_1.z.object({
996
1019
  /**
997
1020
  * Optional hints to use for model selection.
998
1021
  */
@@ -1009,47 +1032,50 @@ exports.ModelPreferencesSchema = zod_1.z
1009
1032
  * How much to prioritize intelligence and capabilities when selecting a model.
1010
1033
  */
1011
1034
  intelligencePriority: zod_1.z.optional(zod_1.z.number().min(0).max(1))
1012
- })
1013
- .passthrough();
1035
+ });
1014
1036
  /**
1015
1037
  * Describes a message issued to or received from an LLM API.
1016
1038
  */
1017
- exports.SamplingMessageSchema = zod_1.z
1018
- .object({
1039
+ exports.SamplingMessageSchema = zod_1.z.object({
1019
1040
  role: zod_1.z.enum(['user', 'assistant']),
1020
1041
  content: zod_1.z.union([exports.TextContentSchema, exports.ImageContentSchema, exports.AudioContentSchema])
1021
- })
1022
- .passthrough();
1042
+ });
1043
+ /**
1044
+ * Parameters for a `sampling/createMessage` request.
1045
+ */
1046
+ exports.CreateMessageRequestParamsSchema = BaseRequestParamsSchema.extend({
1047
+ messages: zod_1.z.array(exports.SamplingMessageSchema),
1048
+ /**
1049
+ * The server's preferences for which model to select. The client MAY modify or omit this request.
1050
+ */
1051
+ modelPreferences: exports.ModelPreferencesSchema.optional(),
1052
+ /**
1053
+ * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1054
+ */
1055
+ systemPrompt: zod_1.z.string().optional(),
1056
+ /**
1057
+ * 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.
1058
+ */
1059
+ includeContext: zod_1.z.enum(['none', 'thisServer', 'allServers']).optional(),
1060
+ temperature: zod_1.z.number().optional(),
1061
+ /**
1062
+ * The requested maximum number of tokens to sample (to prevent runaway completions).
1063
+ *
1064
+ * The client MAY choose to sample fewer tokens than the requested maximum.
1065
+ */
1066
+ maxTokens: zod_1.z.number().int(),
1067
+ stopSequences: zod_1.z.array(zod_1.z.string()).optional(),
1068
+ /**
1069
+ * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1070
+ */
1071
+ metadata: AssertObjectSchema.optional()
1072
+ });
1023
1073
  /**
1024
1074
  * 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.
1025
1075
  */
1026
1076
  exports.CreateMessageRequestSchema = exports.RequestSchema.extend({
1027
1077
  method: zod_1.z.literal('sampling/createMessage'),
1028
- params: BaseRequestParamsSchema.extend({
1029
- messages: zod_1.z.array(exports.SamplingMessageSchema),
1030
- /**
1031
- * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1032
- */
1033
- systemPrompt: zod_1.z.optional(zod_1.z.string()),
1034
- /**
1035
- * 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.
1036
- */
1037
- includeContext: zod_1.z.optional(zod_1.z.enum(['none', 'thisServer', 'allServers'])),
1038
- temperature: zod_1.z.optional(zod_1.z.number()),
1039
- /**
1040
- * The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
1041
- */
1042
- maxTokens: zod_1.z.number().int(),
1043
- stopSequences: zod_1.z.optional(zod_1.z.array(zod_1.z.string())),
1044
- /**
1045
- * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1046
- */
1047
- metadata: zod_1.z.optional(zod_1.z.object({}).passthrough()),
1048
- /**
1049
- * The server's preferences for which model to select.
1050
- */
1051
- modelPreferences: zod_1.z.optional(exports.ModelPreferencesSchema)
1052
- })
1078
+ params: exports.CreateMessageRequestParamsSchema
1053
1079
  });
1054
1080
  /**
1055
1081
  * 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.
@@ -1070,104 +1096,170 @@ exports.CreateMessageResultSchema = exports.ResultSchema.extend({
1070
1096
  /**
1071
1097
  * Primitive schema definition for boolean fields.
1072
1098
  */
1073
- exports.BooleanSchemaSchema = zod_1.z
1074
- .object({
1099
+ exports.BooleanSchemaSchema = zod_1.z.object({
1075
1100
  type: zod_1.z.literal('boolean'),
1076
- title: zod_1.z.optional(zod_1.z.string()),
1077
- description: zod_1.z.optional(zod_1.z.string()),
1078
- default: zod_1.z.optional(zod_1.z.boolean())
1079
- })
1080
- .passthrough();
1101
+ title: zod_1.z.string().optional(),
1102
+ description: zod_1.z.string().optional(),
1103
+ default: zod_1.z.boolean().optional()
1104
+ });
1081
1105
  /**
1082
1106
  * Primitive schema definition for string fields.
1083
1107
  */
1084
- exports.StringSchemaSchema = zod_1.z
1085
- .object({
1108
+ exports.StringSchemaSchema = zod_1.z.object({
1086
1109
  type: zod_1.z.literal('string'),
1087
- title: zod_1.z.optional(zod_1.z.string()),
1088
- description: zod_1.z.optional(zod_1.z.string()),
1089
- minLength: zod_1.z.optional(zod_1.z.number()),
1090
- maxLength: zod_1.z.optional(zod_1.z.number()),
1091
- format: zod_1.z.optional(zod_1.z.enum(['email', 'uri', 'date', 'date-time']))
1092
- })
1093
- .passthrough();
1110
+ title: zod_1.z.string().optional(),
1111
+ description: zod_1.z.string().optional(),
1112
+ minLength: zod_1.z.number().optional(),
1113
+ maxLength: zod_1.z.number().optional(),
1114
+ format: zod_1.z.enum(['email', 'uri', 'date', 'date-time']).optional(),
1115
+ default: zod_1.z.string().optional()
1116
+ });
1094
1117
  /**
1095
1118
  * Primitive schema definition for number fields.
1096
1119
  */
1097
- exports.NumberSchemaSchema = zod_1.z
1098
- .object({
1120
+ exports.NumberSchemaSchema = zod_1.z.object({
1099
1121
  type: zod_1.z.enum(['number', 'integer']),
1100
- title: zod_1.z.optional(zod_1.z.string()),
1101
- description: zod_1.z.optional(zod_1.z.string()),
1102
- minimum: zod_1.z.optional(zod_1.z.number()),
1103
- maximum: zod_1.z.optional(zod_1.z.number())
1104
- })
1105
- .passthrough();
1122
+ title: zod_1.z.string().optional(),
1123
+ description: zod_1.z.string().optional(),
1124
+ minimum: zod_1.z.number().optional(),
1125
+ maximum: zod_1.z.number().optional(),
1126
+ default: zod_1.z.number().optional()
1127
+ });
1106
1128
  /**
1107
- * Primitive schema definition for enum fields.
1129
+ * Schema for single-selection enumeration without display titles for options.
1108
1130
  */
1109
- exports.EnumSchemaSchema = zod_1.z
1110
- .object({
1131
+ exports.UntitledSingleSelectEnumSchemaSchema = zod_1.z.object({
1111
1132
  type: zod_1.z.literal('string'),
1112
- title: zod_1.z.optional(zod_1.z.string()),
1113
- description: zod_1.z.optional(zod_1.z.string()),
1133
+ title: zod_1.z.string().optional(),
1134
+ description: zod_1.z.string().optional(),
1114
1135
  enum: zod_1.z.array(zod_1.z.string()),
1115
- enumNames: zod_1.z.optional(zod_1.z.array(zod_1.z.string()))
1116
- })
1117
- .passthrough();
1136
+ default: zod_1.z.string().optional()
1137
+ });
1138
+ /**
1139
+ * Schema for single-selection enumeration with display titles for each option.
1140
+ */
1141
+ exports.TitledSingleSelectEnumSchemaSchema = zod_1.z.object({
1142
+ type: zod_1.z.literal('string'),
1143
+ title: zod_1.z.string().optional(),
1144
+ description: zod_1.z.string().optional(),
1145
+ oneOf: zod_1.z.array(zod_1.z.object({
1146
+ const: zod_1.z.string(),
1147
+ title: zod_1.z.string()
1148
+ })),
1149
+ default: zod_1.z.string().optional()
1150
+ });
1151
+ /**
1152
+ * Use TitledSingleSelectEnumSchema instead.
1153
+ * This interface will be removed in a future version.
1154
+ */
1155
+ exports.LegacyTitledEnumSchemaSchema = zod_1.z.object({
1156
+ type: zod_1.z.literal('string'),
1157
+ title: zod_1.z.string().optional(),
1158
+ description: zod_1.z.string().optional(),
1159
+ enum: zod_1.z.array(zod_1.z.string()),
1160
+ enumNames: zod_1.z.array(zod_1.z.string()).optional(),
1161
+ default: zod_1.z.string().optional()
1162
+ });
1163
+ // Combined single selection enumeration
1164
+ exports.SingleSelectEnumSchemaSchema = zod_1.z.union([exports.UntitledSingleSelectEnumSchemaSchema, exports.TitledSingleSelectEnumSchemaSchema]);
1165
+ /**
1166
+ * Schema for multiple-selection enumeration without display titles for options.
1167
+ */
1168
+ exports.UntitledMultiSelectEnumSchemaSchema = zod_1.z.object({
1169
+ type: zod_1.z.literal('array'),
1170
+ title: zod_1.z.string().optional(),
1171
+ description: zod_1.z.string().optional(),
1172
+ minItems: zod_1.z.number().optional(),
1173
+ maxItems: zod_1.z.number().optional(),
1174
+ items: zod_1.z.object({
1175
+ type: zod_1.z.literal('string'),
1176
+ enum: zod_1.z.array(zod_1.z.string())
1177
+ }),
1178
+ default: zod_1.z.array(zod_1.z.string()).optional()
1179
+ });
1180
+ /**
1181
+ * Schema for multiple-selection enumeration with display titles for each option.
1182
+ */
1183
+ exports.TitledMultiSelectEnumSchemaSchema = zod_1.z.object({
1184
+ type: zod_1.z.literal('array'),
1185
+ title: zod_1.z.string().optional(),
1186
+ description: zod_1.z.string().optional(),
1187
+ minItems: zod_1.z.number().optional(),
1188
+ maxItems: zod_1.z.number().optional(),
1189
+ items: zod_1.z.object({
1190
+ anyOf: zod_1.z.array(zod_1.z.object({
1191
+ const: zod_1.z.string(),
1192
+ title: zod_1.z.string()
1193
+ }))
1194
+ }),
1195
+ default: zod_1.z.array(zod_1.z.string()).optional()
1196
+ });
1197
+ /**
1198
+ * Combined schema for multiple-selection enumeration
1199
+ */
1200
+ exports.MultiSelectEnumSchemaSchema = zod_1.z.union([exports.UntitledMultiSelectEnumSchemaSchema, exports.TitledMultiSelectEnumSchemaSchema]);
1201
+ /**
1202
+ * Primitive schema definition for enum fields.
1203
+ */
1204
+ exports.EnumSchemaSchema = zod_1.z.union([exports.LegacyTitledEnumSchemaSchema, exports.SingleSelectEnumSchemaSchema, exports.MultiSelectEnumSchemaSchema]);
1118
1205
  /**
1119
1206
  * Union of all primitive schema definitions.
1120
1207
  */
1121
- exports.PrimitiveSchemaDefinitionSchema = zod_1.z.union([exports.BooleanSchemaSchema, exports.StringSchemaSchema, exports.NumberSchemaSchema, exports.EnumSchemaSchema]);
1208
+ exports.PrimitiveSchemaDefinitionSchema = zod_1.z.union([exports.EnumSchemaSchema, exports.BooleanSchemaSchema, exports.StringSchemaSchema, exports.NumberSchemaSchema]);
1209
+ /**
1210
+ * Parameters for an `elicitation/create` request.
1211
+ */
1212
+ exports.ElicitRequestParamsSchema = BaseRequestParamsSchema.extend({
1213
+ /**
1214
+ * The message to present to the user.
1215
+ */
1216
+ message: zod_1.z.string(),
1217
+ /**
1218
+ * A restricted subset of JSON Schema.
1219
+ * Only top-level properties are allowed, without nesting.
1220
+ */
1221
+ requestedSchema: zod_1.z.object({
1222
+ type: zod_1.z.literal('object'),
1223
+ properties: zod_1.z.record(zod_1.z.string(), exports.PrimitiveSchemaDefinitionSchema),
1224
+ required: zod_1.z.array(zod_1.z.string()).optional()
1225
+ })
1226
+ });
1122
1227
  /**
1123
1228
  * A request from the server to elicit user input via the client.
1124
1229
  * The client should present the message and form fields to the user.
1125
1230
  */
1126
1231
  exports.ElicitRequestSchema = exports.RequestSchema.extend({
1127
1232
  method: zod_1.z.literal('elicitation/create'),
1128
- params: BaseRequestParamsSchema.extend({
1129
- /**
1130
- * The message to present to the user.
1131
- */
1132
- message: zod_1.z.string(),
1133
- /**
1134
- * The schema for the requested user input.
1135
- */
1136
- requestedSchema: zod_1.z
1137
- .object({
1138
- type: zod_1.z.literal('object'),
1139
- properties: zod_1.z.record(zod_1.z.string(), exports.PrimitiveSchemaDefinitionSchema),
1140
- required: zod_1.z.optional(zod_1.z.array(zod_1.z.string()))
1141
- })
1142
- .passthrough()
1143
- })
1233
+ params: exports.ElicitRequestParamsSchema
1144
1234
  });
1145
1235
  /**
1146
1236
  * The client's response to an elicitation/create request from the server.
1147
1237
  */
1148
1238
  exports.ElicitResultSchema = exports.ResultSchema.extend({
1149
1239
  /**
1150
- * The user's response action.
1240
+ * The user action in response to the elicitation.
1241
+ * - "accept": User submitted the form/confirmed the action
1242
+ * - "decline": User explicitly decline the action
1243
+ * - "cancel": User dismissed without making an explicit choice
1151
1244
  */
1152
1245
  action: zod_1.z.enum(['accept', 'decline', 'cancel']),
1153
1246
  /**
1154
- * The collected user input content (only present if action is "accept").
1247
+ * The submitted form data, only present when action is "accept".
1248
+ * Contains values matching the requested schema.
1155
1249
  */
1156
- content: zod_1.z.optional(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
1250
+ content: zod_1.z.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.array(zod_1.z.string())])).optional()
1157
1251
  });
1158
1252
  /* Autocomplete */
1159
1253
  /**
1160
1254
  * A reference to a resource or resource template definition.
1161
1255
  */
1162
- exports.ResourceTemplateReferenceSchema = zod_1.z
1163
- .object({
1256
+ exports.ResourceTemplateReferenceSchema = zod_1.z.object({
1164
1257
  type: zod_1.z.literal('ref/resource'),
1165
1258
  /**
1166
1259
  * The URI or URI template of the resource.
1167
1260
  */
1168
1261
  uri: zod_1.z.string()
1169
- })
1170
- .passthrough();
1262
+ });
1171
1263
  /**
1172
1264
  * @deprecated Use ResourceTemplateReferenceSchema instead
1173
1265
  */
@@ -1175,45 +1267,57 @@ exports.ResourceReferenceSchema = exports.ResourceTemplateReferenceSchema;
1175
1267
  /**
1176
1268
  * Identifies a prompt.
1177
1269
  */
1178
- exports.PromptReferenceSchema = zod_1.z
1179
- .object({
1270
+ exports.PromptReferenceSchema = zod_1.z.object({
1180
1271
  type: zod_1.z.literal('ref/prompt'),
1181
1272
  /**
1182
1273
  * The name of the prompt or prompt template
1183
1274
  */
1184
1275
  name: zod_1.z.string()
1185
- })
1186
- .passthrough();
1276
+ });
1187
1277
  /**
1188
- * A request from the client to the server, to ask for completion options.
1278
+ * Parameters for a `completion/complete` request.
1189
1279
  */
1190
- exports.CompleteRequestSchema = exports.RequestSchema.extend({
1191
- method: zod_1.z.literal('completion/complete'),
1192
- params: BaseRequestParamsSchema.extend({
1193
- ref: zod_1.z.union([exports.PromptReferenceSchema, exports.ResourceTemplateReferenceSchema]),
1280
+ exports.CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
1281
+ ref: zod_1.z.union([exports.PromptReferenceSchema, exports.ResourceTemplateReferenceSchema]),
1282
+ /**
1283
+ * The argument's information
1284
+ */
1285
+ argument: zod_1.z.object({
1194
1286
  /**
1195
- * The argument's information
1287
+ * The name of the argument
1196
1288
  */
1197
- argument: zod_1.z
1198
- .object({
1199
- /**
1200
- * The name of the argument
1201
- */
1202
- name: zod_1.z.string(),
1203
- /**
1204
- * The value of the argument to use for completion matching.
1205
- */
1206
- value: zod_1.z.string()
1207
- })
1208
- .passthrough(),
1209
- context: zod_1.z.optional(zod_1.z.object({
1210
- /**
1211
- * Previously-resolved variables in a URI template or prompt.
1212
- */
1213
- arguments: zod_1.z.optional(zod_1.z.record(zod_1.z.string(), zod_1.z.string()))
1214
- }))
1289
+ name: zod_1.z.string(),
1290
+ /**
1291
+ * The value of the argument to use for completion matching.
1292
+ */
1293
+ value: zod_1.z.string()
1294
+ }),
1295
+ context: zod_1.z
1296
+ .object({
1297
+ /**
1298
+ * Previously-resolved variables in a URI template or prompt.
1299
+ */
1300
+ arguments: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional()
1215
1301
  })
1302
+ .optional()
1303
+ });
1304
+ /**
1305
+ * A request from the client to the server, to ask for completion options.
1306
+ */
1307
+ exports.CompleteRequestSchema = exports.RequestSchema.extend({
1308
+ method: zod_1.z.literal('completion/complete'),
1309
+ params: exports.CompleteRequestParamsSchema
1216
1310
  });
1311
+ function assertCompleteRequestPrompt(request) {
1312
+ if (request.params.ref.type !== 'ref/prompt') {
1313
+ throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
1314
+ }
1315
+ }
1316
+ function assertCompleteRequestResourceTemplate(request) {
1317
+ if (request.params.ref.type !== 'ref/resource') {
1318
+ throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);
1319
+ }
1320
+ }
1217
1321
  /**
1218
1322
  * The server's response to a completion/complete request
1219
1323
  */
@@ -1239,8 +1343,7 @@ exports.CompleteResultSchema = exports.ResultSchema.extend({
1239
1343
  /**
1240
1344
  * Represents a root directory or file that the server can operate on.
1241
1345
  */
1242
- exports.RootSchema = zod_1.z
1243
- .object({
1346
+ exports.RootSchema = zod_1.z.object({
1244
1347
  /**
1245
1348
  * The URI identifying the root. This *must* start with file:// for now.
1246
1349
  */
@@ -1248,14 +1351,13 @@ exports.RootSchema = zod_1.z
1248
1351
  /**
1249
1352
  * An optional name for the root.
1250
1353
  */
1251
- name: zod_1.z.optional(zod_1.z.string()),
1354
+ name: zod_1.z.string().optional(),
1252
1355
  /**
1253
1356
  * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
1254
1357
  * for notes on _meta usage.
1255
1358
  */
1256
- _meta: zod_1.z.optional(zod_1.z.object({}).passthrough())
1257
- })
1258
- .passthrough();
1359
+ _meta: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional()
1360
+ });
1259
1361
  /**
1260
1362
  * Sent from the server to request a list of root URIs from the client.
1261
1363
  */