@mcp-b/webmcp-ts-sdk 2.3.1 → 2.3.2
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.
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +731 -37
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
5
5
|
import { ZodOptional } from "zod";
|
|
6
6
|
import { isPlainObject, validateArgsWithSchema } from "@mcp-b/webmcp-polyfill";
|
|
7
7
|
|
|
8
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
8
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
9
9
|
function isZ4Schema(s) {
|
|
10
10
|
return !!s._zod;
|
|
11
11
|
}
|
|
@@ -121,7 +121,7 @@ function getLiteralValue(schema) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
//#endregion
|
|
124
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
124
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
125
125
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
126
126
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
127
127
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -150,7 +150,14 @@ const CursorSchema = z.string();
|
|
|
150
150
|
* Task creation parameters, used to ask that the server create a task to represent a request.
|
|
151
151
|
*/
|
|
152
152
|
const TaskCreationParamsSchema = z.looseObject({
|
|
153
|
+
/**
|
|
154
|
+
* Time in milliseconds to keep task results available after completion.
|
|
155
|
+
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
156
|
+
*/
|
|
153
157
|
ttl: z.union([z.number(), z.null()]).optional(),
|
|
158
|
+
/**
|
|
159
|
+
* Time in milliseconds to wait between task status requests.
|
|
160
|
+
*/
|
|
154
161
|
pollInterval: z.number().optional()
|
|
155
162
|
});
|
|
156
163
|
const TaskMetadataSchema = z.object({ ttl: z.number().optional() });
|
|
@@ -160,17 +167,36 @@ const TaskMetadataSchema = z.object({ ttl: z.number().optional() });
|
|
|
160
167
|
*/
|
|
161
168
|
const RelatedTaskMetadataSchema = z.object({ taskId: z.string() });
|
|
162
169
|
const RequestMetaSchema = z.looseObject({
|
|
170
|
+
/**
|
|
171
|
+
* 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.
|
|
172
|
+
*/
|
|
163
173
|
progressToken: ProgressTokenSchema.optional(),
|
|
174
|
+
/**
|
|
175
|
+
* If specified, this request is related to the provided task.
|
|
176
|
+
*/
|
|
164
177
|
[RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
|
|
165
178
|
});
|
|
166
179
|
/**
|
|
167
180
|
* Common params for any request.
|
|
168
181
|
*/
|
|
169
|
-
const BaseRequestParamsSchema = z.object({
|
|
182
|
+
const BaseRequestParamsSchema = z.object({
|
|
183
|
+
/**
|
|
184
|
+
* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
|
|
185
|
+
*/
|
|
186
|
+
_meta: RequestMetaSchema.optional() });
|
|
170
187
|
/**
|
|
171
188
|
* Common params for any task-augmented request.
|
|
172
189
|
*/
|
|
173
|
-
const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
190
|
+
const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
191
|
+
/**
|
|
192
|
+
* If specified, the caller is requesting task-augmented execution for this request.
|
|
193
|
+
* The request will return a CreateTaskResult immediately, and the actual result can be
|
|
194
|
+
* retrieved later via tasks/result.
|
|
195
|
+
*
|
|
196
|
+
* Task augmentation is subject to capability negotiation - receivers MUST declare support
|
|
197
|
+
* for task augmentation of specific request types in their capabilities.
|
|
198
|
+
*/
|
|
199
|
+
task: TaskMetadataSchema.optional() });
|
|
174
200
|
/**
|
|
175
201
|
* Checks if a value is a valid TaskAugmentedRequestParams.
|
|
176
202
|
* @param value - The value to check.
|
|
@@ -182,12 +208,22 @@ const RequestSchema = z.object({
|
|
|
182
208
|
method: z.string(),
|
|
183
209
|
params: BaseRequestParamsSchema.loose().optional()
|
|
184
210
|
});
|
|
185
|
-
const NotificationsParamsSchema = z.object({
|
|
211
|
+
const NotificationsParamsSchema = z.object({
|
|
212
|
+
/**
|
|
213
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
214
|
+
* for notes on _meta usage.
|
|
215
|
+
*/
|
|
216
|
+
_meta: RequestMetaSchema.optional() });
|
|
186
217
|
const NotificationSchema = z.object({
|
|
187
218
|
method: z.string(),
|
|
188
219
|
params: NotificationsParamsSchema.loose().optional()
|
|
189
220
|
});
|
|
190
|
-
const ResultSchema = z.looseObject({
|
|
221
|
+
const ResultSchema = z.looseObject({
|
|
222
|
+
/**
|
|
223
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
224
|
+
* for notes on _meta usage.
|
|
225
|
+
*/
|
|
226
|
+
_meta: RequestMetaSchema.optional() });
|
|
191
227
|
/**
|
|
192
228
|
* A uniquely identifying ID for a request in JSON-RPC.
|
|
193
229
|
*/
|
|
@@ -245,8 +281,17 @@ const JSONRPCErrorResponseSchema = z.object({
|
|
|
245
281
|
jsonrpc: z.literal("2.0"),
|
|
246
282
|
id: RequestIdSchema.optional(),
|
|
247
283
|
error: z.object({
|
|
284
|
+
/**
|
|
285
|
+
* The error type that occurred.
|
|
286
|
+
*/
|
|
248
287
|
code: z.number().int(),
|
|
288
|
+
/**
|
|
289
|
+
* A short description of the error. The message SHOULD be limited to a concise single sentence.
|
|
290
|
+
*/
|
|
249
291
|
message: z.string(),
|
|
292
|
+
/**
|
|
293
|
+
* Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
|
|
294
|
+
*/
|
|
250
295
|
data: z.unknown().optional()
|
|
251
296
|
})
|
|
252
297
|
}).strict();
|
|
@@ -269,7 +314,15 @@ const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCError
|
|
|
269
314
|
*/
|
|
270
315
|
const EmptyResultSchema = ResultSchema.strict();
|
|
271
316
|
const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
317
|
+
/**
|
|
318
|
+
* The ID of the request to cancel.
|
|
319
|
+
*
|
|
320
|
+
* This MUST correspond to the ID of a request previously issued in the same direction.
|
|
321
|
+
*/
|
|
272
322
|
requestId: RequestIdSchema.optional(),
|
|
323
|
+
/**
|
|
324
|
+
* An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
|
|
325
|
+
*/
|
|
273
326
|
reason: z.string().optional()
|
|
274
327
|
});
|
|
275
328
|
/**
|
|
@@ -289,21 +342,61 @@ const CancelledNotificationSchema = NotificationSchema.extend({
|
|
|
289
342
|
* Icon schema for use in tools, prompts, resources, and implementations.
|
|
290
343
|
*/
|
|
291
344
|
const IconSchema = z.object({
|
|
345
|
+
/**
|
|
346
|
+
* URL or data URI for the icon.
|
|
347
|
+
*/
|
|
292
348
|
src: z.string(),
|
|
349
|
+
/**
|
|
350
|
+
* Optional MIME type for the icon.
|
|
351
|
+
*/
|
|
293
352
|
mimeType: z.string().optional(),
|
|
353
|
+
/**
|
|
354
|
+
* Optional array of strings that specify sizes at which the icon can be used.
|
|
355
|
+
* Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
|
|
356
|
+
*
|
|
357
|
+
* If not provided, the client should assume that the icon can be used at any size.
|
|
358
|
+
*/
|
|
294
359
|
sizes: z.array(z.string()).optional(),
|
|
360
|
+
/**
|
|
361
|
+
* Optional specifier for the theme this icon is designed for. `light` indicates
|
|
362
|
+
* the icon is designed to be used with a light background, and `dark` indicates
|
|
363
|
+
* the icon is designed to be used with a dark background.
|
|
364
|
+
*
|
|
365
|
+
* If not provided, the client should assume the icon can be used with any theme.
|
|
366
|
+
*/
|
|
295
367
|
theme: z.enum(["light", "dark"]).optional()
|
|
296
368
|
});
|
|
297
369
|
/**
|
|
298
370
|
* Base schema to add `icons` property.
|
|
299
371
|
*
|
|
300
372
|
*/
|
|
301
|
-
const IconsSchema = z.object({
|
|
373
|
+
const IconsSchema = z.object({
|
|
374
|
+
/**
|
|
375
|
+
* Optional set of sized icons that the client can display in a user interface.
|
|
376
|
+
*
|
|
377
|
+
* Clients that support rendering icons MUST support at least the following MIME types:
|
|
378
|
+
* - `image/png` - PNG images (safe, universal compatibility)
|
|
379
|
+
* - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
|
|
380
|
+
*
|
|
381
|
+
* Clients that support rendering icons SHOULD also support:
|
|
382
|
+
* - `image/svg+xml` - SVG images (scalable but requires security precautions)
|
|
383
|
+
* - `image/webp` - WebP images (modern, efficient format)
|
|
384
|
+
*/
|
|
385
|
+
icons: z.array(IconSchema).optional() });
|
|
302
386
|
/**
|
|
303
387
|
* Base metadata interface for common properties across resources, tools, prompts, and implementations.
|
|
304
388
|
*/
|
|
305
389
|
const BaseMetadataSchema = z.object({
|
|
390
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
306
391
|
name: z.string(),
|
|
392
|
+
/**
|
|
393
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
394
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
395
|
+
*
|
|
396
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
397
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
398
|
+
* if present).
|
|
399
|
+
*/
|
|
307
400
|
title: z.string().optional()
|
|
308
401
|
});
|
|
309
402
|
/**
|
|
@@ -313,7 +406,17 @@ const ImplementationSchema = BaseMetadataSchema.extend({
|
|
|
313
406
|
...BaseMetadataSchema.shape,
|
|
314
407
|
...IconsSchema.shape,
|
|
315
408
|
version: z.string(),
|
|
409
|
+
/**
|
|
410
|
+
* An optional URL of the website for this implementation.
|
|
411
|
+
*/
|
|
316
412
|
websiteUrl: z.string().optional(),
|
|
413
|
+
/**
|
|
414
|
+
* An optional human-readable description of what this implementation does.
|
|
415
|
+
*
|
|
416
|
+
* This can be used by clients or servers to provide context about their purpose
|
|
417
|
+
* and capabilities. For example, a server might describe the types of resources
|
|
418
|
+
* or tools it provides, while a client might describe its intended use case.
|
|
419
|
+
*/
|
|
317
420
|
description: z.string().optional()
|
|
318
421
|
});
|
|
319
422
|
const FormElicitationCapabilitySchema = z.intersection(z.object({ applyDefaults: z.boolean().optional() }), z.record(z.string(), z.unknown()));
|
|
@@ -330,10 +433,25 @@ const ElicitationCapabilitySchema = z.preprocess((value) => {
|
|
|
330
433
|
* Task capabilities for clients, indicating which request types support task creation.
|
|
331
434
|
*/
|
|
332
435
|
const ClientTasksCapabilitySchema = z.looseObject({
|
|
436
|
+
/**
|
|
437
|
+
* Present if the client supports listing tasks.
|
|
438
|
+
*/
|
|
333
439
|
list: AssertObjectSchema.optional(),
|
|
440
|
+
/**
|
|
441
|
+
* Present if the client supports cancelling tasks.
|
|
442
|
+
*/
|
|
334
443
|
cancel: AssertObjectSchema.optional(),
|
|
444
|
+
/**
|
|
445
|
+
* Capabilities for task creation on specific request types.
|
|
446
|
+
*/
|
|
335
447
|
requests: z.looseObject({
|
|
448
|
+
/**
|
|
449
|
+
* Task support for sampling requests.
|
|
450
|
+
*/
|
|
336
451
|
sampling: z.looseObject({ createMessage: AssertObjectSchema.optional() }).optional(),
|
|
452
|
+
/**
|
|
453
|
+
* Task support for elicitation requests.
|
|
454
|
+
*/
|
|
337
455
|
elicitation: z.looseObject({ create: AssertObjectSchema.optional() }).optional()
|
|
338
456
|
}).optional()
|
|
339
457
|
});
|
|
@@ -341,24 +459,66 @@ const ClientTasksCapabilitySchema = z.looseObject({
|
|
|
341
459
|
* Task capabilities for servers, indicating which request types support task creation.
|
|
342
460
|
*/
|
|
343
461
|
const ServerTasksCapabilitySchema = z.looseObject({
|
|
462
|
+
/**
|
|
463
|
+
* Present if the server supports listing tasks.
|
|
464
|
+
*/
|
|
344
465
|
list: AssertObjectSchema.optional(),
|
|
466
|
+
/**
|
|
467
|
+
* Present if the server supports cancelling tasks.
|
|
468
|
+
*/
|
|
345
469
|
cancel: AssertObjectSchema.optional(),
|
|
346
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Capabilities for task creation on specific request types.
|
|
472
|
+
*/
|
|
473
|
+
requests: z.looseObject({
|
|
474
|
+
/**
|
|
475
|
+
* Task support for tool requests.
|
|
476
|
+
*/
|
|
477
|
+
tools: z.looseObject({ call: AssertObjectSchema.optional() }).optional() }).optional()
|
|
347
478
|
});
|
|
348
479
|
/**
|
|
349
480
|
* 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.
|
|
350
481
|
*/
|
|
351
482
|
const ClientCapabilitiesSchema = z.object({
|
|
483
|
+
/**
|
|
484
|
+
* Experimental, non-standard capabilities that the client supports.
|
|
485
|
+
*/
|
|
352
486
|
experimental: z.record(z.string(), AssertObjectSchema).optional(),
|
|
487
|
+
/**
|
|
488
|
+
* Present if the client supports sampling from an LLM.
|
|
489
|
+
*/
|
|
353
490
|
sampling: z.object({
|
|
491
|
+
/**
|
|
492
|
+
* Present if the client supports context inclusion via includeContext parameter.
|
|
493
|
+
* If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
|
|
494
|
+
*/
|
|
354
495
|
context: AssertObjectSchema.optional(),
|
|
496
|
+
/**
|
|
497
|
+
* Present if the client supports tool use via tools and toolChoice parameters.
|
|
498
|
+
*/
|
|
355
499
|
tools: AssertObjectSchema.optional()
|
|
356
500
|
}).optional(),
|
|
501
|
+
/**
|
|
502
|
+
* Present if the client supports eliciting user input.
|
|
503
|
+
*/
|
|
357
504
|
elicitation: ElicitationCapabilitySchema.optional(),
|
|
358
|
-
|
|
505
|
+
/**
|
|
506
|
+
* Present if the client supports listing roots.
|
|
507
|
+
*/
|
|
508
|
+
roots: z.object({
|
|
509
|
+
/**
|
|
510
|
+
* Whether the client supports issuing notifications for changes to the roots list.
|
|
511
|
+
*/
|
|
512
|
+
listChanged: z.boolean().optional() }).optional(),
|
|
513
|
+
/**
|
|
514
|
+
* Present if the client supports task creation.
|
|
515
|
+
*/
|
|
359
516
|
tasks: ClientTasksCapabilitySchema.optional()
|
|
360
517
|
});
|
|
361
518
|
const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
519
|
+
/**
|
|
520
|
+
* The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
|
|
521
|
+
*/
|
|
362
522
|
protocolVersion: z.string(),
|
|
363
523
|
capabilities: ClientCapabilitiesSchema,
|
|
364
524
|
clientInfo: ImplementationSchema
|
|
@@ -374,24 +534,67 @@ const InitializeRequestSchema = RequestSchema.extend({
|
|
|
374
534
|
* 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.
|
|
375
535
|
*/
|
|
376
536
|
const ServerCapabilitiesSchema = z.object({
|
|
537
|
+
/**
|
|
538
|
+
* Experimental, non-standard capabilities that the server supports.
|
|
539
|
+
*/
|
|
377
540
|
experimental: z.record(z.string(), AssertObjectSchema).optional(),
|
|
541
|
+
/**
|
|
542
|
+
* Present if the server supports sending log messages to the client.
|
|
543
|
+
*/
|
|
378
544
|
logging: AssertObjectSchema.optional(),
|
|
545
|
+
/**
|
|
546
|
+
* Present if the server supports sending completions to the client.
|
|
547
|
+
*/
|
|
379
548
|
completions: AssertObjectSchema.optional(),
|
|
380
|
-
|
|
549
|
+
/**
|
|
550
|
+
* Present if the server offers any prompt templates.
|
|
551
|
+
*/
|
|
552
|
+
prompts: z.object({
|
|
553
|
+
/**
|
|
554
|
+
* Whether this server supports issuing notifications for changes to the prompt list.
|
|
555
|
+
*/
|
|
556
|
+
listChanged: z.boolean().optional() }).optional(),
|
|
557
|
+
/**
|
|
558
|
+
* Present if the server offers any resources to read.
|
|
559
|
+
*/
|
|
381
560
|
resources: z.object({
|
|
561
|
+
/**
|
|
562
|
+
* Whether this server supports clients subscribing to resource updates.
|
|
563
|
+
*/
|
|
382
564
|
subscribe: z.boolean().optional(),
|
|
565
|
+
/**
|
|
566
|
+
* Whether this server supports issuing notifications for changes to the resource list.
|
|
567
|
+
*/
|
|
383
568
|
listChanged: z.boolean().optional()
|
|
384
569
|
}).optional(),
|
|
385
|
-
|
|
570
|
+
/**
|
|
571
|
+
* Present if the server offers any tools to call.
|
|
572
|
+
*/
|
|
573
|
+
tools: z.object({
|
|
574
|
+
/**
|
|
575
|
+
* Whether this server supports issuing notifications for changes to the tool list.
|
|
576
|
+
*/
|
|
577
|
+
listChanged: z.boolean().optional() }).optional(),
|
|
578
|
+
/**
|
|
579
|
+
* Present if the server supports task creation.
|
|
580
|
+
*/
|
|
386
581
|
tasks: ServerTasksCapabilitySchema.optional()
|
|
387
582
|
});
|
|
388
583
|
/**
|
|
389
584
|
* After receiving an initialize request from the client, the server sends this response.
|
|
390
585
|
*/
|
|
391
586
|
const InitializeResultSchema = ResultSchema.extend({
|
|
587
|
+
/**
|
|
588
|
+
* The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
|
|
589
|
+
*/
|
|
392
590
|
protocolVersion: z.string(),
|
|
393
591
|
capabilities: ServerCapabilitiesSchema,
|
|
394
592
|
serverInfo: ImplementationSchema,
|
|
593
|
+
/**
|
|
594
|
+
* Instructions describing how to use the server and its features.
|
|
595
|
+
*
|
|
596
|
+
* 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.
|
|
597
|
+
*/
|
|
395
598
|
instructions: z.string().optional()
|
|
396
599
|
});
|
|
397
600
|
/**
|
|
@@ -409,13 +612,25 @@ const PingRequestSchema = RequestSchema.extend({
|
|
|
409
612
|
params: BaseRequestParamsSchema.optional()
|
|
410
613
|
});
|
|
411
614
|
const ProgressSchema = z.object({
|
|
615
|
+
/**
|
|
616
|
+
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
|
|
617
|
+
*/
|
|
412
618
|
progress: z.number(),
|
|
619
|
+
/**
|
|
620
|
+
* Total number of items to process (or total progress required), if known.
|
|
621
|
+
*/
|
|
413
622
|
total: z.optional(z.number()),
|
|
623
|
+
/**
|
|
624
|
+
* An optional message describing the current progress.
|
|
625
|
+
*/
|
|
414
626
|
message: z.optional(z.string())
|
|
415
627
|
});
|
|
416
628
|
const ProgressNotificationParamsSchema = z.object({
|
|
417
629
|
...NotificationsParamsSchema.shape,
|
|
418
630
|
...ProgressSchema.shape,
|
|
631
|
+
/**
|
|
632
|
+
* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
|
|
633
|
+
*/
|
|
419
634
|
progressToken: ProgressTokenSchema
|
|
420
635
|
});
|
|
421
636
|
/**
|
|
@@ -427,9 +642,19 @@ const ProgressNotificationSchema = NotificationSchema.extend({
|
|
|
427
642
|
method: z.literal("notifications/progress"),
|
|
428
643
|
params: ProgressNotificationParamsSchema
|
|
429
644
|
});
|
|
430
|
-
const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
645
|
+
const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
646
|
+
/**
|
|
647
|
+
* An opaque token representing the current pagination position.
|
|
648
|
+
* If provided, the server should return results starting after this cursor.
|
|
649
|
+
*/
|
|
650
|
+
cursor: CursorSchema.optional() });
|
|
431
651
|
const PaginatedRequestSchema = RequestSchema.extend({ params: PaginatedRequestParamsSchema.optional() });
|
|
432
|
-
const PaginatedResultSchema = ResultSchema.extend({
|
|
652
|
+
const PaginatedResultSchema = ResultSchema.extend({
|
|
653
|
+
/**
|
|
654
|
+
* An opaque token representing the pagination position after the last returned result.
|
|
655
|
+
* If present, there may be more results available.
|
|
656
|
+
*/
|
|
657
|
+
nextCursor: CursorSchema.optional() });
|
|
433
658
|
/**
|
|
434
659
|
* The status of a task.
|
|
435
660
|
* */
|
|
@@ -446,10 +671,23 @@ const TaskStatusSchema = z.enum([
|
|
|
446
671
|
const TaskSchema = z.object({
|
|
447
672
|
taskId: z.string(),
|
|
448
673
|
status: TaskStatusSchema,
|
|
674
|
+
/**
|
|
675
|
+
* Time in milliseconds to keep task results available after completion.
|
|
676
|
+
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
677
|
+
*/
|
|
449
678
|
ttl: z.union([z.number(), z.null()]),
|
|
679
|
+
/**
|
|
680
|
+
* ISO 8601 timestamp when the task was created.
|
|
681
|
+
*/
|
|
450
682
|
createdAt: z.string(),
|
|
683
|
+
/**
|
|
684
|
+
* ISO 8601 timestamp when the task was last updated.
|
|
685
|
+
*/
|
|
451
686
|
lastUpdatedAt: z.string(),
|
|
452
687
|
pollInterval: z.optional(z.number()),
|
|
688
|
+
/**
|
|
689
|
+
* Optional diagnostic message for failed tasks or other status information.
|
|
690
|
+
*/
|
|
453
691
|
statusMessage: z.optional(z.string())
|
|
454
692
|
});
|
|
455
693
|
/**
|
|
@@ -515,11 +753,25 @@ const CancelTaskResultSchema = ResultSchema.merge(TaskSchema);
|
|
|
515
753
|
* The contents of a specific resource or sub-resource.
|
|
516
754
|
*/
|
|
517
755
|
const ResourceContentsSchema = z.object({
|
|
756
|
+
/**
|
|
757
|
+
* The URI of this resource.
|
|
758
|
+
*/
|
|
518
759
|
uri: z.string(),
|
|
760
|
+
/**
|
|
761
|
+
* The MIME type of this resource, if known.
|
|
762
|
+
*/
|
|
519
763
|
mimeType: z.optional(z.string()),
|
|
764
|
+
/**
|
|
765
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
766
|
+
* for notes on _meta usage.
|
|
767
|
+
*/
|
|
520
768
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
521
769
|
});
|
|
522
|
-
const TextResourceContentsSchema = ResourceContentsSchema.extend({
|
|
770
|
+
const TextResourceContentsSchema = ResourceContentsSchema.extend({
|
|
771
|
+
/**
|
|
772
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
773
|
+
*/
|
|
774
|
+
text: z.string() });
|
|
523
775
|
/**
|
|
524
776
|
* A Zod schema for validating Base64 strings that is more performant and
|
|
525
777
|
* robust for very large inputs than the default regex-based check. It avoids
|
|
@@ -533,7 +785,11 @@ const Base64Schema = z.string().refine((val) => {
|
|
|
533
785
|
return false;
|
|
534
786
|
}
|
|
535
787
|
}, { message: "Invalid Base64 string" });
|
|
536
|
-
const BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|
788
|
+
const BlobResourceContentsSchema = ResourceContentsSchema.extend({
|
|
789
|
+
/**
|
|
790
|
+
* A base64-encoded string representing the binary data of the item.
|
|
791
|
+
*/
|
|
792
|
+
blob: Base64Schema });
|
|
537
793
|
/**
|
|
538
794
|
* The sender or recipient of messages and data in a conversation.
|
|
539
795
|
*/
|
|
@@ -542,8 +798,17 @@ const RoleSchema = z.enum(["user", "assistant"]);
|
|
|
542
798
|
* Optional annotations providing clients additional context about a resource.
|
|
543
799
|
*/
|
|
544
800
|
const AnnotationsSchema = z.object({
|
|
801
|
+
/**
|
|
802
|
+
* Intended audience(s) for the resource.
|
|
803
|
+
*/
|
|
545
804
|
audience: z.array(RoleSchema).optional(),
|
|
805
|
+
/**
|
|
806
|
+
* Importance hint for the resource, from 0 (least) to 1 (most).
|
|
807
|
+
*/
|
|
546
808
|
priority: z.number().min(0).max(1).optional(),
|
|
809
|
+
/**
|
|
810
|
+
* ISO 8601 timestamp for the most recent modification.
|
|
811
|
+
*/
|
|
547
812
|
lastModified: z.iso.datetime({ offset: true }).optional()
|
|
548
813
|
});
|
|
549
814
|
/**
|
|
@@ -552,10 +817,28 @@ const AnnotationsSchema = z.object({
|
|
|
552
817
|
const ResourceSchema = z.object({
|
|
553
818
|
...BaseMetadataSchema.shape,
|
|
554
819
|
...IconsSchema.shape,
|
|
820
|
+
/**
|
|
821
|
+
* The URI of this resource.
|
|
822
|
+
*/
|
|
555
823
|
uri: z.string(),
|
|
824
|
+
/**
|
|
825
|
+
* A description of what this resource represents.
|
|
826
|
+
*
|
|
827
|
+
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
|
828
|
+
*/
|
|
556
829
|
description: z.optional(z.string()),
|
|
830
|
+
/**
|
|
831
|
+
* The MIME type of this resource, if known.
|
|
832
|
+
*/
|
|
557
833
|
mimeType: z.optional(z.string()),
|
|
834
|
+
/**
|
|
835
|
+
* Optional annotations for the client.
|
|
836
|
+
*/
|
|
558
837
|
annotations: AnnotationsSchema.optional(),
|
|
838
|
+
/**
|
|
839
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
840
|
+
* for notes on _meta usage.
|
|
841
|
+
*/
|
|
559
842
|
_meta: z.optional(z.looseObject({}))
|
|
560
843
|
});
|
|
561
844
|
/**
|
|
@@ -564,10 +847,28 @@ const ResourceSchema = z.object({
|
|
|
564
847
|
const ResourceTemplateSchema = z.object({
|
|
565
848
|
...BaseMetadataSchema.shape,
|
|
566
849
|
...IconsSchema.shape,
|
|
850
|
+
/**
|
|
851
|
+
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
|
852
|
+
*/
|
|
567
853
|
uriTemplate: z.string(),
|
|
854
|
+
/**
|
|
855
|
+
* A description of what this template is for.
|
|
856
|
+
*
|
|
857
|
+
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
|
858
|
+
*/
|
|
568
859
|
description: z.optional(z.string()),
|
|
860
|
+
/**
|
|
861
|
+
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
|
|
862
|
+
*/
|
|
569
863
|
mimeType: z.optional(z.string()),
|
|
864
|
+
/**
|
|
865
|
+
* Optional annotations for the client.
|
|
866
|
+
*/
|
|
570
867
|
annotations: AnnotationsSchema.optional(),
|
|
868
|
+
/**
|
|
869
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
870
|
+
* for notes on _meta usage.
|
|
871
|
+
*/
|
|
571
872
|
_meta: z.optional(z.looseObject({}))
|
|
572
873
|
});
|
|
573
874
|
/**
|
|
@@ -586,7 +887,13 @@ const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ metho
|
|
|
586
887
|
* The server's response to a resources/templates/list request from the client.
|
|
587
888
|
*/
|
|
588
889
|
const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({ resourceTemplates: z.array(ResourceTemplateSchema) });
|
|
589
|
-
const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
890
|
+
const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
891
|
+
/**
|
|
892
|
+
* The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
|
|
893
|
+
*
|
|
894
|
+
* @format uri
|
|
895
|
+
*/
|
|
896
|
+
uri: z.string() });
|
|
590
897
|
/**
|
|
591
898
|
* Parameters for a `resources/read` request.
|
|
592
899
|
*/
|
|
@@ -628,7 +935,11 @@ const UnsubscribeRequestSchema = RequestSchema.extend({
|
|
|
628
935
|
/**
|
|
629
936
|
* Parameters for a `notifications/resources/updated` notification.
|
|
630
937
|
*/
|
|
631
|
-
const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
938
|
+
const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
939
|
+
/**
|
|
940
|
+
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
|
|
941
|
+
*/
|
|
942
|
+
uri: z.string() });
|
|
632
943
|
/**
|
|
633
944
|
* 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.
|
|
634
945
|
*/
|
|
@@ -640,8 +951,17 @@ const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
|
|
|
640
951
|
* Describes an argument that a prompt can accept.
|
|
641
952
|
*/
|
|
642
953
|
const PromptArgumentSchema = z.object({
|
|
954
|
+
/**
|
|
955
|
+
* The name of the argument.
|
|
956
|
+
*/
|
|
643
957
|
name: z.string(),
|
|
958
|
+
/**
|
|
959
|
+
* A human-readable description of the argument.
|
|
960
|
+
*/
|
|
644
961
|
description: z.optional(z.string()),
|
|
962
|
+
/**
|
|
963
|
+
* Whether this argument must be provided.
|
|
964
|
+
*/
|
|
645
965
|
required: z.optional(z.boolean())
|
|
646
966
|
});
|
|
647
967
|
/**
|
|
@@ -650,8 +970,18 @@ const PromptArgumentSchema = z.object({
|
|
|
650
970
|
const PromptSchema = z.object({
|
|
651
971
|
...BaseMetadataSchema.shape,
|
|
652
972
|
...IconsSchema.shape,
|
|
973
|
+
/**
|
|
974
|
+
* An optional description of what this prompt provides
|
|
975
|
+
*/
|
|
653
976
|
description: z.optional(z.string()),
|
|
977
|
+
/**
|
|
978
|
+
* A list of arguments to use for templating the prompt.
|
|
979
|
+
*/
|
|
654
980
|
arguments: z.optional(z.array(PromptArgumentSchema)),
|
|
981
|
+
/**
|
|
982
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
983
|
+
* for notes on _meta usage.
|
|
984
|
+
*/
|
|
655
985
|
_meta: z.optional(z.looseObject({}))
|
|
656
986
|
});
|
|
657
987
|
/**
|
|
@@ -666,7 +996,13 @@ const ListPromptsResultSchema = PaginatedResultSchema.extend({ prompts: z.array(
|
|
|
666
996
|
* Parameters for a `prompts/get` request.
|
|
667
997
|
*/
|
|
668
998
|
const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
999
|
+
/**
|
|
1000
|
+
* The name of the prompt or prompt template.
|
|
1001
|
+
*/
|
|
669
1002
|
name: z.string(),
|
|
1003
|
+
/**
|
|
1004
|
+
* Arguments to use for templating the prompt.
|
|
1005
|
+
*/
|
|
670
1006
|
arguments: z.record(z.string(), z.string()).optional()
|
|
671
1007
|
});
|
|
672
1008
|
/**
|
|
@@ -681,8 +1017,18 @@ const GetPromptRequestSchema = RequestSchema.extend({
|
|
|
681
1017
|
*/
|
|
682
1018
|
const TextContentSchema = z.object({
|
|
683
1019
|
type: z.literal("text"),
|
|
1020
|
+
/**
|
|
1021
|
+
* The text content of the message.
|
|
1022
|
+
*/
|
|
684
1023
|
text: z.string(),
|
|
1024
|
+
/**
|
|
1025
|
+
* Optional annotations for the client.
|
|
1026
|
+
*/
|
|
685
1027
|
annotations: AnnotationsSchema.optional(),
|
|
1028
|
+
/**
|
|
1029
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1030
|
+
* for notes on _meta usage.
|
|
1031
|
+
*/
|
|
686
1032
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
687
1033
|
});
|
|
688
1034
|
/**
|
|
@@ -690,9 +1036,22 @@ const TextContentSchema = z.object({
|
|
|
690
1036
|
*/
|
|
691
1037
|
const ImageContentSchema = z.object({
|
|
692
1038
|
type: z.literal("image"),
|
|
1039
|
+
/**
|
|
1040
|
+
* The base64-encoded image data.
|
|
1041
|
+
*/
|
|
693
1042
|
data: Base64Schema,
|
|
1043
|
+
/**
|
|
1044
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
1045
|
+
*/
|
|
694
1046
|
mimeType: z.string(),
|
|
1047
|
+
/**
|
|
1048
|
+
* Optional annotations for the client.
|
|
1049
|
+
*/
|
|
695
1050
|
annotations: AnnotationsSchema.optional(),
|
|
1051
|
+
/**
|
|
1052
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1053
|
+
* for notes on _meta usage.
|
|
1054
|
+
*/
|
|
696
1055
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
697
1056
|
});
|
|
698
1057
|
/**
|
|
@@ -700,9 +1059,22 @@ const ImageContentSchema = z.object({
|
|
|
700
1059
|
*/
|
|
701
1060
|
const AudioContentSchema = z.object({
|
|
702
1061
|
type: z.literal("audio"),
|
|
1062
|
+
/**
|
|
1063
|
+
* The base64-encoded audio data.
|
|
1064
|
+
*/
|
|
703
1065
|
data: Base64Schema,
|
|
1066
|
+
/**
|
|
1067
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
1068
|
+
*/
|
|
704
1069
|
mimeType: z.string(),
|
|
1070
|
+
/**
|
|
1071
|
+
* Optional annotations for the client.
|
|
1072
|
+
*/
|
|
705
1073
|
annotations: AnnotationsSchema.optional(),
|
|
1074
|
+
/**
|
|
1075
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1076
|
+
* for notes on _meta usage.
|
|
1077
|
+
*/
|
|
706
1078
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
707
1079
|
});
|
|
708
1080
|
/**
|
|
@@ -711,9 +1083,25 @@ const AudioContentSchema = z.object({
|
|
|
711
1083
|
*/
|
|
712
1084
|
const ToolUseContentSchema = z.object({
|
|
713
1085
|
type: z.literal("tool_use"),
|
|
1086
|
+
/**
|
|
1087
|
+
* The name of the tool to invoke.
|
|
1088
|
+
* Must match a tool name from the request's tools array.
|
|
1089
|
+
*/
|
|
714
1090
|
name: z.string(),
|
|
1091
|
+
/**
|
|
1092
|
+
* Unique identifier for this tool call.
|
|
1093
|
+
* Used to correlate with ToolResultContent in subsequent messages.
|
|
1094
|
+
*/
|
|
715
1095
|
id: z.string(),
|
|
1096
|
+
/**
|
|
1097
|
+
* Arguments to pass to the tool.
|
|
1098
|
+
* Must conform to the tool's inputSchema.
|
|
1099
|
+
*/
|
|
716
1100
|
input: z.record(z.string(), z.unknown()),
|
|
1101
|
+
/**
|
|
1102
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1103
|
+
* for notes on _meta usage.
|
|
1104
|
+
*/
|
|
717
1105
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
718
1106
|
});
|
|
719
1107
|
/**
|
|
@@ -722,7 +1110,14 @@ const ToolUseContentSchema = z.object({
|
|
|
722
1110
|
const EmbeddedResourceSchema = z.object({
|
|
723
1111
|
type: z.literal("resource"),
|
|
724
1112
|
resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
1113
|
+
/**
|
|
1114
|
+
* Optional annotations for the client.
|
|
1115
|
+
*/
|
|
725
1116
|
annotations: AnnotationsSchema.optional(),
|
|
1117
|
+
/**
|
|
1118
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1119
|
+
* for notes on _meta usage.
|
|
1120
|
+
*/
|
|
726
1121
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
727
1122
|
});
|
|
728
1123
|
/**
|
|
@@ -752,6 +1147,9 @@ const PromptMessageSchema = z.object({
|
|
|
752
1147
|
* The server's response to a prompts/get request from the client.
|
|
753
1148
|
*/
|
|
754
1149
|
const GetPromptResultSchema = ResultSchema.extend({
|
|
1150
|
+
/**
|
|
1151
|
+
* An optional description for the prompt.
|
|
1152
|
+
*/
|
|
755
1153
|
description: z.string().optional(),
|
|
756
1154
|
messages: z.array(PromptMessageSchema)
|
|
757
1155
|
});
|
|
@@ -773,16 +1171,57 @@ const PromptListChangedNotificationSchema = NotificationSchema.extend({
|
|
|
773
1171
|
* received from untrusted servers.
|
|
774
1172
|
*/
|
|
775
1173
|
const ToolAnnotationsSchema = z.object({
|
|
1174
|
+
/**
|
|
1175
|
+
* A human-readable title for the tool.
|
|
1176
|
+
*/
|
|
776
1177
|
title: z.string().optional(),
|
|
1178
|
+
/**
|
|
1179
|
+
* If true, the tool does not modify its environment.
|
|
1180
|
+
*
|
|
1181
|
+
* Default: false
|
|
1182
|
+
*/
|
|
777
1183
|
readOnlyHint: z.boolean().optional(),
|
|
1184
|
+
/**
|
|
1185
|
+
* If true, the tool may perform destructive updates to its environment.
|
|
1186
|
+
* If false, the tool performs only additive updates.
|
|
1187
|
+
*
|
|
1188
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
1189
|
+
*
|
|
1190
|
+
* Default: true
|
|
1191
|
+
*/
|
|
778
1192
|
destructiveHint: z.boolean().optional(),
|
|
1193
|
+
/**
|
|
1194
|
+
* If true, calling the tool repeatedly with the same arguments
|
|
1195
|
+
* will have no additional effect on the its environment.
|
|
1196
|
+
*
|
|
1197
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
1198
|
+
*
|
|
1199
|
+
* Default: false
|
|
1200
|
+
*/
|
|
779
1201
|
idempotentHint: z.boolean().optional(),
|
|
1202
|
+
/**
|
|
1203
|
+
* If true, this tool may interact with an "open world" of external
|
|
1204
|
+
* entities. If false, the tool's domain of interaction is closed.
|
|
1205
|
+
* For example, the world of a web search tool is open, whereas that
|
|
1206
|
+
* of a memory tool is not.
|
|
1207
|
+
*
|
|
1208
|
+
* Default: true
|
|
1209
|
+
*/
|
|
780
1210
|
openWorldHint: z.boolean().optional()
|
|
781
1211
|
});
|
|
782
1212
|
/**
|
|
783
1213
|
* Execution-related properties for a tool.
|
|
784
1214
|
*/
|
|
785
|
-
const ToolExecutionSchema = z.object({
|
|
1215
|
+
const ToolExecutionSchema = z.object({
|
|
1216
|
+
/**
|
|
1217
|
+
* Indicates the tool's preference for task-augmented execution.
|
|
1218
|
+
* - "required": Clients MUST invoke the tool as a task
|
|
1219
|
+
* - "optional": Clients MAY invoke the tool as a task or normal request
|
|
1220
|
+
* - "forbidden": Clients MUST NOT attempt to invoke the tool as a task
|
|
1221
|
+
*
|
|
1222
|
+
* If not present, defaults to "forbidden".
|
|
1223
|
+
*/
|
|
1224
|
+
taskSupport: z.enum([
|
|
786
1225
|
"required",
|
|
787
1226
|
"optional",
|
|
788
1227
|
"forbidden"
|
|
@@ -793,19 +1232,41 @@ const ToolExecutionSchema = z.object({ taskSupport: z.enum([
|
|
|
793
1232
|
const ToolSchema = z.object({
|
|
794
1233
|
...BaseMetadataSchema.shape,
|
|
795
1234
|
...IconsSchema.shape,
|
|
1235
|
+
/**
|
|
1236
|
+
* A human-readable description of the tool.
|
|
1237
|
+
*/
|
|
796
1238
|
description: z.string().optional(),
|
|
1239
|
+
/**
|
|
1240
|
+
* A JSON Schema 2020-12 object defining the expected parameters for the tool.
|
|
1241
|
+
* Must have type: 'object' at the root level per MCP spec.
|
|
1242
|
+
*/
|
|
797
1243
|
inputSchema: z.object({
|
|
798
1244
|
type: z.literal("object"),
|
|
799
1245
|
properties: z.record(z.string(), AssertObjectSchema).optional(),
|
|
800
1246
|
required: z.array(z.string()).optional()
|
|
801
1247
|
}).catchall(z.unknown()),
|
|
1248
|
+
/**
|
|
1249
|
+
* An optional JSON Schema 2020-12 object defining the structure of the tool's output
|
|
1250
|
+
* returned in the structuredContent field of a CallToolResult.
|
|
1251
|
+
* Must have type: 'object' at the root level per MCP spec.
|
|
1252
|
+
*/
|
|
802
1253
|
outputSchema: z.object({
|
|
803
1254
|
type: z.literal("object"),
|
|
804
1255
|
properties: z.record(z.string(), AssertObjectSchema).optional(),
|
|
805
1256
|
required: z.array(z.string()).optional()
|
|
806
1257
|
}).catchall(z.unknown()).optional(),
|
|
1258
|
+
/**
|
|
1259
|
+
* Optional additional tool information.
|
|
1260
|
+
*/
|
|
807
1261
|
annotations: ToolAnnotationsSchema.optional(),
|
|
1262
|
+
/**
|
|
1263
|
+
* Execution-related properties for this tool.
|
|
1264
|
+
*/
|
|
808
1265
|
execution: ToolExecutionSchema.optional(),
|
|
1266
|
+
/**
|
|
1267
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1268
|
+
* for notes on _meta usage.
|
|
1269
|
+
*/
|
|
809
1270
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
810
1271
|
});
|
|
811
1272
|
/**
|
|
@@ -820,8 +1281,33 @@ const ListToolsResultSchema = PaginatedResultSchema.extend({ tools: z.array(Tool
|
|
|
820
1281
|
* The server's response to a tool call.
|
|
821
1282
|
*/
|
|
822
1283
|
const CallToolResultSchema = ResultSchema.extend({
|
|
1284
|
+
/**
|
|
1285
|
+
* A list of content objects that represent the result of the tool call.
|
|
1286
|
+
*
|
|
1287
|
+
* If the Tool does not define an outputSchema, this field MUST be present in the result.
|
|
1288
|
+
* For backwards compatibility, this field is always present, but it may be empty.
|
|
1289
|
+
*/
|
|
823
1290
|
content: z.array(ContentBlockSchema).default([]),
|
|
1291
|
+
/**
|
|
1292
|
+
* An object containing structured tool output.
|
|
1293
|
+
*
|
|
1294
|
+
* If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
|
|
1295
|
+
*/
|
|
824
1296
|
structuredContent: z.record(z.string(), z.unknown()).optional(),
|
|
1297
|
+
/**
|
|
1298
|
+
* Whether the tool call ended in an error.
|
|
1299
|
+
*
|
|
1300
|
+
* If not set, this is assumed to be false (the call was successful).
|
|
1301
|
+
*
|
|
1302
|
+
* Any errors that originate from the tool SHOULD be reported inside the result
|
|
1303
|
+
* object, with `isError` set to true, _not_ as an MCP protocol-level error
|
|
1304
|
+
* response. Otherwise, the LLM would not be able to see that an error occurred
|
|
1305
|
+
* and self-correct.
|
|
1306
|
+
*
|
|
1307
|
+
* However, any errors in _finding_ the tool, an error indicating that the
|
|
1308
|
+
* server does not support tool calls, or any other exceptional conditions,
|
|
1309
|
+
* should be reported as an MCP error response.
|
|
1310
|
+
*/
|
|
825
1311
|
isError: z.boolean().optional()
|
|
826
1312
|
});
|
|
827
1313
|
/**
|
|
@@ -832,7 +1318,13 @@ const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.e
|
|
|
832
1318
|
* Parameters for a `tools/call` request.
|
|
833
1319
|
*/
|
|
834
1320
|
const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1321
|
+
/**
|
|
1322
|
+
* The name of the tool to call.
|
|
1323
|
+
*/
|
|
835
1324
|
name: z.string(),
|
|
1325
|
+
/**
|
|
1326
|
+
* Arguments to pass to the tool.
|
|
1327
|
+
*/
|
|
836
1328
|
arguments: z.record(z.string(), z.unknown()).optional()
|
|
837
1329
|
});
|
|
838
1330
|
/**
|
|
@@ -854,7 +1346,23 @@ const ToolListChangedNotificationSchema = NotificationSchema.extend({
|
|
|
854
1346
|
* Used internally for Zod validation of autoRefresh and debounceMs.
|
|
855
1347
|
*/
|
|
856
1348
|
const ListChangedOptionsBaseSchema = z.object({
|
|
1349
|
+
/**
|
|
1350
|
+
* If true, the list will be refreshed automatically when a list changed notification is received.
|
|
1351
|
+
* The callback will be called with the updated list.
|
|
1352
|
+
*
|
|
1353
|
+
* If false, the callback will be called with null items, allowing manual refresh.
|
|
1354
|
+
*
|
|
1355
|
+
* @default true
|
|
1356
|
+
*/
|
|
857
1357
|
autoRefresh: z.boolean().default(true),
|
|
1358
|
+
/**
|
|
1359
|
+
* Debounce time in milliseconds for list changed notification processing.
|
|
1360
|
+
*
|
|
1361
|
+
* Multiple notifications received within this timeframe will only trigger one refresh.
|
|
1362
|
+
* Set to 0 to disable debouncing.
|
|
1363
|
+
*
|
|
1364
|
+
* @default 300
|
|
1365
|
+
*/
|
|
858
1366
|
debounceMs: z.number().int().nonnegative().default(300)
|
|
859
1367
|
});
|
|
860
1368
|
/**
|
|
@@ -873,7 +1381,11 @@ const LoggingLevelSchema = z.enum([
|
|
|
873
1381
|
/**
|
|
874
1382
|
* Parameters for a `logging/setLevel` request.
|
|
875
1383
|
*/
|
|
876
|
-
const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
1384
|
+
const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
1385
|
+
/**
|
|
1386
|
+
* 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.
|
|
1387
|
+
*/
|
|
1388
|
+
level: LoggingLevelSchema });
|
|
877
1389
|
/**
|
|
878
1390
|
* A request from the client to the server, to enable or adjust logging.
|
|
879
1391
|
*/
|
|
@@ -885,8 +1397,17 @@ const SetLevelRequestSchema = RequestSchema.extend({
|
|
|
885
1397
|
* Parameters for a `notifications/message` notification.
|
|
886
1398
|
*/
|
|
887
1399
|
const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
1400
|
+
/**
|
|
1401
|
+
* The severity of this log message.
|
|
1402
|
+
*/
|
|
888
1403
|
level: LoggingLevelSchema,
|
|
1404
|
+
/**
|
|
1405
|
+
* An optional name of the logger issuing this message.
|
|
1406
|
+
*/
|
|
889
1407
|
logger: z.string().optional(),
|
|
1408
|
+
/**
|
|
1409
|
+
* The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
|
|
1410
|
+
*/
|
|
890
1411
|
data: z.unknown()
|
|
891
1412
|
});
|
|
892
1413
|
/**
|
|
@@ -899,20 +1420,43 @@ const LoggingMessageNotificationSchema = NotificationSchema.extend({
|
|
|
899
1420
|
/**
|
|
900
1421
|
* Hints to use for model selection.
|
|
901
1422
|
*/
|
|
902
|
-
const ModelHintSchema = z.object({
|
|
1423
|
+
const ModelHintSchema = z.object({
|
|
1424
|
+
/**
|
|
1425
|
+
* A hint for a model name.
|
|
1426
|
+
*/
|
|
1427
|
+
name: z.string().optional() });
|
|
903
1428
|
/**
|
|
904
1429
|
* The server's preferences for model selection, requested of the client during sampling.
|
|
905
1430
|
*/
|
|
906
1431
|
const ModelPreferencesSchema = z.object({
|
|
1432
|
+
/**
|
|
1433
|
+
* Optional hints to use for model selection.
|
|
1434
|
+
*/
|
|
907
1435
|
hints: z.array(ModelHintSchema).optional(),
|
|
1436
|
+
/**
|
|
1437
|
+
* How much to prioritize cost when selecting a model.
|
|
1438
|
+
*/
|
|
908
1439
|
costPriority: z.number().min(0).max(1).optional(),
|
|
1440
|
+
/**
|
|
1441
|
+
* How much to prioritize sampling speed (latency) when selecting a model.
|
|
1442
|
+
*/
|
|
909
1443
|
speedPriority: z.number().min(0).max(1).optional(),
|
|
1444
|
+
/**
|
|
1445
|
+
* How much to prioritize intelligence and capabilities when selecting a model.
|
|
1446
|
+
*/
|
|
910
1447
|
intelligencePriority: z.number().min(0).max(1).optional()
|
|
911
1448
|
});
|
|
912
1449
|
/**
|
|
913
1450
|
* Controls tool usage behavior in sampling requests.
|
|
914
1451
|
*/
|
|
915
|
-
const ToolChoiceSchema = z.object({
|
|
1452
|
+
const ToolChoiceSchema = z.object({
|
|
1453
|
+
/**
|
|
1454
|
+
* Controls when tools are used:
|
|
1455
|
+
* - "auto": Model decides whether to use tools (default)
|
|
1456
|
+
* - "required": Model MUST use at least one tool before completing
|
|
1457
|
+
* - "none": Model MUST NOT use any tools
|
|
1458
|
+
*/
|
|
1459
|
+
mode: z.enum([
|
|
916
1460
|
"auto",
|
|
917
1461
|
"required",
|
|
918
1462
|
"none"
|
|
@@ -927,6 +1471,10 @@ const ToolResultContentSchema = z.object({
|
|
|
927
1471
|
content: z.array(ContentBlockSchema).default([]),
|
|
928
1472
|
structuredContent: z.object({}).loose().optional(),
|
|
929
1473
|
isError: z.boolean().optional(),
|
|
1474
|
+
/**
|
|
1475
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1476
|
+
* for notes on _meta usage.
|
|
1477
|
+
*/
|
|
930
1478
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
931
1479
|
});
|
|
932
1480
|
/**
|
|
@@ -955,6 +1503,10 @@ const SamplingMessageContentBlockSchema = z.discriminatedUnion("type", [
|
|
|
955
1503
|
const SamplingMessageSchema = z.object({
|
|
956
1504
|
role: RoleSchema,
|
|
957
1505
|
content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]),
|
|
1506
|
+
/**
|
|
1507
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1508
|
+
* for notes on _meta usage.
|
|
1509
|
+
*/
|
|
958
1510
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
959
1511
|
});
|
|
960
1512
|
/**
|
|
@@ -962,18 +1514,48 @@ const SamplingMessageSchema = z.object({
|
|
|
962
1514
|
*/
|
|
963
1515
|
const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
964
1516
|
messages: z.array(SamplingMessageSchema),
|
|
1517
|
+
/**
|
|
1518
|
+
* The server's preferences for which model to select. The client MAY modify or omit this request.
|
|
1519
|
+
*/
|
|
965
1520
|
modelPreferences: ModelPreferencesSchema.optional(),
|
|
1521
|
+
/**
|
|
1522
|
+
* An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
|
|
1523
|
+
*/
|
|
966
1524
|
systemPrompt: z.string().optional(),
|
|
1525
|
+
/**
|
|
1526
|
+
* A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
|
|
1527
|
+
* The client MAY ignore this request.
|
|
1528
|
+
*
|
|
1529
|
+
* Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
|
|
1530
|
+
* declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
|
|
1531
|
+
*/
|
|
967
1532
|
includeContext: z.enum([
|
|
968
1533
|
"none",
|
|
969
1534
|
"thisServer",
|
|
970
1535
|
"allServers"
|
|
971
1536
|
]).optional(),
|
|
972
1537
|
temperature: z.number().optional(),
|
|
1538
|
+
/**
|
|
1539
|
+
* The requested maximum number of tokens to sample (to prevent runaway completions).
|
|
1540
|
+
*
|
|
1541
|
+
* The client MAY choose to sample fewer tokens than the requested maximum.
|
|
1542
|
+
*/
|
|
973
1543
|
maxTokens: z.number().int(),
|
|
974
1544
|
stopSequences: z.array(z.string()).optional(),
|
|
1545
|
+
/**
|
|
1546
|
+
* Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
|
|
1547
|
+
*/
|
|
975
1548
|
metadata: AssertObjectSchema.optional(),
|
|
1549
|
+
/**
|
|
1550
|
+
* Tools that the model may use during generation.
|
|
1551
|
+
* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
|
|
1552
|
+
*/
|
|
976
1553
|
tools: z.array(ToolSchema).optional(),
|
|
1554
|
+
/**
|
|
1555
|
+
* Controls how the model uses tools.
|
|
1556
|
+
* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
|
|
1557
|
+
* Default is `{ mode: "auto" }`.
|
|
1558
|
+
*/
|
|
977
1559
|
toolChoice: ToolChoiceSchema.optional()
|
|
978
1560
|
});
|
|
979
1561
|
/**
|
|
@@ -989,13 +1571,29 @@ const CreateMessageRequestSchema = RequestSchema.extend({
|
|
|
989
1571
|
* Used when the request does not include tools.
|
|
990
1572
|
*/
|
|
991
1573
|
const CreateMessageResultSchema = ResultSchema.extend({
|
|
1574
|
+
/**
|
|
1575
|
+
* The name of the model that generated the message.
|
|
1576
|
+
*/
|
|
992
1577
|
model: z.string(),
|
|
1578
|
+
/**
|
|
1579
|
+
* The reason why sampling stopped, if known.
|
|
1580
|
+
*
|
|
1581
|
+
* Standard values:
|
|
1582
|
+
* - "endTurn": Natural end of the assistant's turn
|
|
1583
|
+
* - "stopSequence": A stop sequence was encountered
|
|
1584
|
+
* - "maxTokens": Maximum token limit was reached
|
|
1585
|
+
*
|
|
1586
|
+
* This field is an open string to allow for provider-specific stop reasons.
|
|
1587
|
+
*/
|
|
993
1588
|
stopReason: z.optional(z.enum([
|
|
994
1589
|
"endTurn",
|
|
995
1590
|
"stopSequence",
|
|
996
1591
|
"maxTokens"
|
|
997
1592
|
]).or(z.string())),
|
|
998
1593
|
role: RoleSchema,
|
|
1594
|
+
/**
|
|
1595
|
+
* Response content. Single content block (text, image, or audio).
|
|
1596
|
+
*/
|
|
999
1597
|
content: SamplingContentSchema
|
|
1000
1598
|
});
|
|
1001
1599
|
/**
|
|
@@ -1003,7 +1601,21 @@ const CreateMessageResultSchema = ResultSchema.extend({
|
|
|
1003
1601
|
* This version supports array content for tool use flows.
|
|
1004
1602
|
*/
|
|
1005
1603
|
const CreateMessageResultWithToolsSchema = ResultSchema.extend({
|
|
1604
|
+
/**
|
|
1605
|
+
* The name of the model that generated the message.
|
|
1606
|
+
*/
|
|
1006
1607
|
model: z.string(),
|
|
1608
|
+
/**
|
|
1609
|
+
* The reason why sampling stopped, if known.
|
|
1610
|
+
*
|
|
1611
|
+
* Standard values:
|
|
1612
|
+
* - "endTurn": Natural end of the assistant's turn
|
|
1613
|
+
* - "stopSequence": A stop sequence was encountered
|
|
1614
|
+
* - "maxTokens": Maximum token limit was reached
|
|
1615
|
+
* - "toolUse": The model wants to use one or more tools
|
|
1616
|
+
*
|
|
1617
|
+
* This field is an open string to allow for provider-specific stop reasons.
|
|
1618
|
+
*/
|
|
1007
1619
|
stopReason: z.optional(z.enum([
|
|
1008
1620
|
"endTurn",
|
|
1009
1621
|
"stopSequence",
|
|
@@ -1011,6 +1623,9 @@ const CreateMessageResultWithToolsSchema = ResultSchema.extend({
|
|
|
1011
1623
|
"toolUse"
|
|
1012
1624
|
]).or(z.string())),
|
|
1013
1625
|
role: RoleSchema,
|
|
1626
|
+
/**
|
|
1627
|
+
* Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
|
|
1628
|
+
*/
|
|
1014
1629
|
content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)])
|
|
1015
1630
|
});
|
|
1016
1631
|
/**
|
|
@@ -1141,8 +1756,20 @@ const PrimitiveSchemaDefinitionSchema = z.union([
|
|
|
1141
1756
|
* Parameters for an `elicitation/create` request for form-based elicitation.
|
|
1142
1757
|
*/
|
|
1143
1758
|
const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1759
|
+
/**
|
|
1760
|
+
* The elicitation mode.
|
|
1761
|
+
*
|
|
1762
|
+
* Optional for backward compatibility. Clients MUST treat missing mode as "form".
|
|
1763
|
+
*/
|
|
1144
1764
|
mode: z.literal("form").optional(),
|
|
1765
|
+
/**
|
|
1766
|
+
* The message to present to the user describing what information is being requested.
|
|
1767
|
+
*/
|
|
1145
1768
|
message: z.string(),
|
|
1769
|
+
/**
|
|
1770
|
+
* A restricted subset of JSON Schema.
|
|
1771
|
+
* Only top-level properties are allowed, without nesting.
|
|
1772
|
+
*/
|
|
1146
1773
|
requestedSchema: z.object({
|
|
1147
1774
|
type: z.literal("object"),
|
|
1148
1775
|
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
|
|
@@ -1153,9 +1780,22 @@ const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
|
1153
1780
|
* Parameters for an `elicitation/create` request for URL-based elicitation.
|
|
1154
1781
|
*/
|
|
1155
1782
|
const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({
|
|
1783
|
+
/**
|
|
1784
|
+
* The elicitation mode.
|
|
1785
|
+
*/
|
|
1156
1786
|
mode: z.literal("url"),
|
|
1787
|
+
/**
|
|
1788
|
+
* The message to present to the user explaining why the interaction is needed.
|
|
1789
|
+
*/
|
|
1157
1790
|
message: z.string(),
|
|
1791
|
+
/**
|
|
1792
|
+
* The ID of the elicitation, which must be unique within the context of the server.
|
|
1793
|
+
* The client MUST treat this ID as an opaque value.
|
|
1794
|
+
*/
|
|
1158
1795
|
elicitationId: z.string(),
|
|
1796
|
+
/**
|
|
1797
|
+
* The URL that the user should navigate to.
|
|
1798
|
+
*/
|
|
1159
1799
|
url: z.string().url()
|
|
1160
1800
|
});
|
|
1161
1801
|
/**
|
|
@@ -1176,7 +1816,11 @@ const ElicitRequestSchema = RequestSchema.extend({
|
|
|
1176
1816
|
*
|
|
1177
1817
|
* @category notifications/elicitation/complete
|
|
1178
1818
|
*/
|
|
1179
|
-
const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
1819
|
+
const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
1820
|
+
/**
|
|
1821
|
+
* The ID of the elicitation that completed.
|
|
1822
|
+
*/
|
|
1823
|
+
elicitationId: z.string() });
|
|
1180
1824
|
/**
|
|
1181
1825
|
* A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.
|
|
1182
1826
|
*
|
|
@@ -1190,11 +1834,23 @@ const ElicitationCompleteNotificationSchema = NotificationSchema.extend({
|
|
|
1190
1834
|
* The client's response to an elicitation/create request from the server.
|
|
1191
1835
|
*/
|
|
1192
1836
|
const ElicitResultSchema = ResultSchema.extend({
|
|
1837
|
+
/**
|
|
1838
|
+
* The user action in response to the elicitation.
|
|
1839
|
+
* - "accept": User submitted the form/confirmed the action
|
|
1840
|
+
* - "decline": User explicitly decline the action
|
|
1841
|
+
* - "cancel": User dismissed without making an explicit choice
|
|
1842
|
+
*/
|
|
1193
1843
|
action: z.enum([
|
|
1194
1844
|
"accept",
|
|
1195
1845
|
"decline",
|
|
1196
1846
|
"cancel"
|
|
1197
1847
|
]),
|
|
1848
|
+
/**
|
|
1849
|
+
* The submitted form data, only present when action is "accept".
|
|
1850
|
+
* Contains values matching the requested schema.
|
|
1851
|
+
* Per MCP spec, content is "typically omitted" for decline/cancel actions.
|
|
1852
|
+
* We normalize null to undefined for leniency while maintaining type compatibility.
|
|
1853
|
+
*/
|
|
1198
1854
|
content: z.preprocess((val) => val === null ? void 0 : val, z.record(z.string(), z.union([
|
|
1199
1855
|
z.string(),
|
|
1200
1856
|
z.number(),
|
|
@@ -1207,6 +1863,9 @@ const ElicitResultSchema = ResultSchema.extend({
|
|
|
1207
1863
|
*/
|
|
1208
1864
|
const ResourceTemplateReferenceSchema = z.object({
|
|
1209
1865
|
type: z.literal("ref/resource"),
|
|
1866
|
+
/**
|
|
1867
|
+
* The URI or URI template of the resource.
|
|
1868
|
+
*/
|
|
1210
1869
|
uri: z.string()
|
|
1211
1870
|
});
|
|
1212
1871
|
/**
|
|
@@ -1214,6 +1873,9 @@ const ResourceTemplateReferenceSchema = z.object({
|
|
|
1214
1873
|
*/
|
|
1215
1874
|
const PromptReferenceSchema = z.object({
|
|
1216
1875
|
type: z.literal("ref/prompt"),
|
|
1876
|
+
/**
|
|
1877
|
+
* The name of the prompt or prompt template
|
|
1878
|
+
*/
|
|
1217
1879
|
name: z.string()
|
|
1218
1880
|
});
|
|
1219
1881
|
/**
|
|
@@ -1221,11 +1883,24 @@ const PromptReferenceSchema = z.object({
|
|
|
1221
1883
|
*/
|
|
1222
1884
|
const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
1223
1885
|
ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
|
|
1886
|
+
/**
|
|
1887
|
+
* The argument's information
|
|
1888
|
+
*/
|
|
1224
1889
|
argument: z.object({
|
|
1890
|
+
/**
|
|
1891
|
+
* The name of the argument
|
|
1892
|
+
*/
|
|
1225
1893
|
name: z.string(),
|
|
1894
|
+
/**
|
|
1895
|
+
* The value of the argument to use for completion matching.
|
|
1896
|
+
*/
|
|
1226
1897
|
value: z.string()
|
|
1227
1898
|
}),
|
|
1228
|
-
context: z.object({
|
|
1899
|
+
context: z.object({
|
|
1900
|
+
/**
|
|
1901
|
+
* Previously-resolved variables in a URI template or prompt.
|
|
1902
|
+
*/
|
|
1903
|
+
arguments: z.record(z.string(), z.string()).optional() }).optional()
|
|
1229
1904
|
});
|
|
1230
1905
|
/**
|
|
1231
1906
|
* A request from the client to the server, to ask for completion options.
|
|
@@ -1244,16 +1919,35 @@ function assertCompleteRequestResourceTemplate(request) {
|
|
|
1244
1919
|
* The server's response to a completion/complete request
|
|
1245
1920
|
*/
|
|
1246
1921
|
const CompleteResultSchema = ResultSchema.extend({ completion: z.looseObject({
|
|
1922
|
+
/**
|
|
1923
|
+
* An array of completion values. Must not exceed 100 items.
|
|
1924
|
+
*/
|
|
1247
1925
|
values: z.array(z.string()).max(100),
|
|
1926
|
+
/**
|
|
1927
|
+
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
|
1928
|
+
*/
|
|
1248
1929
|
total: z.optional(z.number().int()),
|
|
1930
|
+
/**
|
|
1931
|
+
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
|
1932
|
+
*/
|
|
1249
1933
|
hasMore: z.optional(z.boolean())
|
|
1250
1934
|
}) });
|
|
1251
1935
|
/**
|
|
1252
1936
|
* Represents a root directory or file that the server can operate on.
|
|
1253
1937
|
*/
|
|
1254
1938
|
const RootSchema = z.object({
|
|
1939
|
+
/**
|
|
1940
|
+
* The URI identifying the root. This *must* start with file:// for now.
|
|
1941
|
+
*/
|
|
1255
1942
|
uri: z.string().startsWith("file://"),
|
|
1943
|
+
/**
|
|
1944
|
+
* An optional name for the root.
|
|
1945
|
+
*/
|
|
1256
1946
|
name: z.string().optional(),
|
|
1947
|
+
/**
|
|
1948
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1949
|
+
* for notes on _meta usage.
|
|
1950
|
+
*/
|
|
1257
1951
|
_meta: z.record(z.string(), z.unknown()).optional()
|
|
1258
1952
|
});
|
|
1259
1953
|
/**
|
|
@@ -1378,7 +2072,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
1378
2072
|
};
|
|
1379
2073
|
|
|
1380
2074
|
//#endregion
|
|
1381
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
2075
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
1382
2076
|
/**
|
|
1383
2077
|
* Experimental task interfaces for MCP SDK.
|
|
1384
2078
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -1396,7 +2090,7 @@ function isTerminal(status) {
|
|
|
1396
2090
|
}
|
|
1397
2091
|
|
|
1398
2092
|
//#endregion
|
|
1399
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
2093
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
1400
2094
|
function mapMiniTarget(t) {
|
|
1401
2095
|
if (!t) return "draft-7";
|
|
1402
2096
|
if (t === "jsonSchema7" || t === "draft-7") return "draft-7";
|
|
@@ -1427,7 +2121,7 @@ function parseWithCompat(schema, data) {
|
|
|
1427
2121
|
}
|
|
1428
2122
|
|
|
1429
2123
|
//#endregion
|
|
1430
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
2124
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
1431
2125
|
/**
|
|
1432
2126
|
* The default request timeout, in miliseconds.
|
|
1433
2127
|
*/
|
|
@@ -2310,7 +3004,7 @@ var Ajv = class {
|
|
|
2310
3004
|
function addFormats(_ajv) {}
|
|
2311
3005
|
|
|
2312
3006
|
//#endregion
|
|
2313
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3007
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
2314
3008
|
/**
|
|
2315
3009
|
* AJV-based JSON Schema validator provider
|
|
2316
3010
|
*/
|
|
@@ -2388,7 +3082,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
2388
3082
|
};
|
|
2389
3083
|
|
|
2390
3084
|
//#endregion
|
|
2391
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3085
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
|
|
2392
3086
|
/**
|
|
2393
3087
|
* Experimental client task features for MCP SDK.
|
|
2394
3088
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -2562,7 +3256,7 @@ var ExperimentalClientTasks = class {
|
|
|
2562
3256
|
};
|
|
2563
3257
|
|
|
2564
3258
|
//#endregion
|
|
2565
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3259
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
2566
3260
|
/**
|
|
2567
3261
|
* Experimental task capability assertion helpers.
|
|
2568
3262
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -2614,7 +3308,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
2614
3308
|
}
|
|
2615
3309
|
|
|
2616
3310
|
//#endregion
|
|
2617
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3311
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
|
|
2618
3312
|
/**
|
|
2619
3313
|
* Elicitation default application helper. Applies defaults to the data based on the schema.
|
|
2620
3314
|
*
|
|
@@ -3095,7 +3789,7 @@ var Client = class extends Protocol {
|
|
|
3095
3789
|
};
|
|
3096
3790
|
|
|
3097
3791
|
//#endregion
|
|
3098
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3792
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
3099
3793
|
/**
|
|
3100
3794
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
3101
3795
|
*/
|
|
@@ -3123,7 +3817,7 @@ function serializeMessage(message) {
|
|
|
3123
3817
|
}
|
|
3124
3818
|
|
|
3125
3819
|
//#endregion
|
|
3126
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3820
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
3127
3821
|
/**
|
|
3128
3822
|
* Experimental server task features for MCP SDK.
|
|
3129
3823
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -3214,7 +3908,7 @@ var ExperimentalServerTasks = class {
|
|
|
3214
3908
|
};
|
|
3215
3909
|
|
|
3216
3910
|
//#endregion
|
|
3217
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
3911
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
3218
3912
|
/**
|
|
3219
3913
|
* An MCP server on top of a pluggable transport.
|
|
3220
3914
|
*
|
|
@@ -3556,7 +4250,7 @@ var Server = class extends Protocol {
|
|
|
3556
4250
|
};
|
|
3557
4251
|
|
|
3558
4252
|
//#endregion
|
|
3559
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
4253
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
3560
4254
|
const COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
3561
4255
|
/**
|
|
3562
4256
|
* Checks if a schema is completable (has completion metadata).
|
|
@@ -3576,7 +4270,7 @@ var McpZodTypeKind;
|
|
|
3576
4270
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
3577
4271
|
|
|
3578
4272
|
//#endregion
|
|
3579
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
4273
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
3580
4274
|
/**
|
|
3581
4275
|
* Tool name validation utilities according to SEP: Specify Format for Tool Names
|
|
3582
4276
|
*
|
|
@@ -3648,7 +4342,7 @@ function validateAndWarnToolName(name) {
|
|
|
3648
4342
|
}
|
|
3649
4343
|
|
|
3650
4344
|
//#endregion
|
|
3651
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
4345
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
3652
4346
|
/**
|
|
3653
4347
|
* Experimental McpServer task features for MCP SDK.
|
|
3654
4348
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -3680,7 +4374,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
3680
4374
|
};
|
|
3681
4375
|
|
|
3682
4376
|
//#endregion
|
|
3683
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3
|
|
4377
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
3684
4378
|
/**
|
|
3685
4379
|
* High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
|
|
3686
4380
|
* For advanced usage (like sending notifications or setting custom request handlers), use the underlying
|