@mastra/mcp 1.17.1-alpha.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { NodeStreamableHTTPServerTransport, hostHeaderValidation, originValidati
20
20
  import { ProtocolError, ProtocolErrorCode as ProtocolErrorCode$1, Server, createMcpHandler } from "@modelcontextprotocol/server";
21
21
  import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
22
22
  import { SSEServerTransport } from "@modelcontextprotocol/server-legacy/sse";
23
+ import { JSONRPCMessageSchema } from "@modelcontextprotocol/sdk/types.js";
23
24
  //#region \0rolldown/runtime.js
24
25
  var __defProp$3 = Object.defineProperty;
25
26
  var __exportAll = (all, no_symbols) => {
@@ -2566,7 +2567,7 @@ const getDiscriminator = (type) => {
2566
2567
  else if (type instanceof ZodCatch$1) return getDiscriminator(type._def.innerType);
2567
2568
  else return [];
2568
2569
  };
2569
- var ZodDiscriminatedUnion$1 = class ZodDiscriminatedUnion$1 extends ZodType$1 {
2570
+ var ZodDiscriminatedUnion = class ZodDiscriminatedUnion extends ZodType$1 {
2570
2571
  _parse(input) {
2571
2572
  const { ctx } = this._processInputParams(input);
2572
2573
  if (ctx.parsedType !== ZodParsedType.object) {
@@ -2626,7 +2627,7 @@ var ZodDiscriminatedUnion$1 = class ZodDiscriminatedUnion$1 extends ZodType$1 {
2626
2627
  optionsMap.set(value, type);
2627
2628
  }
2628
2629
  }
2629
- return new ZodDiscriminatedUnion$1({
2630
+ return new ZodDiscriminatedUnion({
2630
2631
  typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2631
2632
  discriminator,
2632
2633
  options,
@@ -3692,7 +3693,7 @@ const arrayType = ZodArray$1.create;
3692
3693
  const objectType = ZodObject$1.create;
3693
3694
  const strictObjectType = ZodObject$1.strictCreate;
3694
3695
  const unionType = ZodUnion$1.create;
3695
- const discriminatedUnionType = ZodDiscriminatedUnion$1.create;
3696
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
3696
3697
  const intersectionType = ZodIntersection$1.create;
3697
3698
  const tupleType = ZodTuple$1.create;
3698
3699
  const recordType = ZodRecord$1.create;
@@ -3754,7 +3755,7 @@ var v3_default = /* @__PURE__ */ __exportAll({
3754
3755
  ZodCatch: () => ZodCatch$1,
3755
3756
  ZodDate: () => ZodDate,
3756
3757
  ZodDefault: () => ZodDefault$1,
3757
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion$1,
3758
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
3758
3759
  ZodEffects: () => ZodEffects,
3759
3760
  ZodEnum: () => ZodEnum$1,
3760
3761
  ZodError: () => ZodError,
@@ -6722,62 +6723,6 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
6722
6723
  });
6723
6724
  };
6724
6725
  });
6725
- const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
6726
- def.inclusive = false;
6727
- $ZodUnion.init(inst, def);
6728
- const _super = inst._zod.parse;
6729
- defineLazy(inst._zod, "propValues", () => {
6730
- const propValues = {};
6731
- for (const option of def.options) {
6732
- const pv = option._zod.propValues;
6733
- if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
6734
- for (const [k, v] of Object.entries(pv)) {
6735
- if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
6736
- for (const val of v) propValues[k].add(val);
6737
- }
6738
- }
6739
- return propValues;
6740
- });
6741
- const disc = cached(() => {
6742
- const opts = def.options;
6743
- const map = /* @__PURE__ */ new Map();
6744
- for (const o of opts) {
6745
- const values = o._zod.propValues?.[def.discriminator];
6746
- if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
6747
- for (const v of values) {
6748
- if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
6749
- map.set(v, o);
6750
- }
6751
- }
6752
- return map;
6753
- });
6754
- inst._zod.parse = (payload, ctx) => {
6755
- const input = payload.value;
6756
- if (!isObject(input)) {
6757
- payload.issues.push({
6758
- code: "invalid_type",
6759
- expected: "object",
6760
- input,
6761
- inst
6762
- });
6763
- return payload;
6764
- }
6765
- const opt = disc.value.get(input?.[def.discriminator]);
6766
- if (opt) return opt._zod.run(payload, ctx);
6767
- if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
6768
- payload.issues.push({
6769
- code: "invalid_union",
6770
- errors: [],
6771
- note: "No matching discriminator",
6772
- discriminator: def.discriminator,
6773
- options: Array.from(disc.value.keys()),
6774
- input,
6775
- path: [def.discriminator],
6776
- inst
6777
- });
6778
- return payload;
6779
- };
6780
- });
6781
6726
  const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
6782
6727
  $ZodType.init(inst, def);
6783
6728
  inst._zod.parse = (payload, ctx) => {
@@ -7313,9 +7258,6 @@ function handlePipeResult(left, next, ctx) {
7313
7258
  fallback: left.fallback
7314
7259
  }, ctx);
7315
7260
  }
7316
- const $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
7317
- $ZodPipe.init(inst, def);
7318
- });
7319
7261
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
7320
7262
  $ZodType.init(inst, def);
7321
7263
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
@@ -9335,14 +9277,6 @@ function object$1(shape, params) {
9335
9277
  };
9336
9278
  return new ZodObject(def);
9337
9279
  }
9338
- function looseObject(shape, params) {
9339
- return new ZodObject({
9340
- type: "object",
9341
- shape,
9342
- catchall: unknown(),
9343
- ...normalizeParams(params)
9344
- });
9345
- }
9346
9280
  const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
9347
9281
  $ZodUnion.init(inst, def);
9348
9282
  ZodType.init(inst, def);
@@ -9356,18 +9290,6 @@ function union(options, params) {
9356
9290
  ...normalizeParams(params)
9357
9291
  });
9358
9292
  }
9359
- const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
9360
- ZodUnion.init(inst, def);
9361
- $ZodDiscriminatedUnion.init(inst, def);
9362
- });
9363
- function discriminatedUnion(discriminator, options, params) {
9364
- return new ZodDiscriminatedUnion({
9365
- type: "union",
9366
- options,
9367
- discriminator,
9368
- ...normalizeParams(params)
9369
- });
9370
- }
9371
9293
  const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
9372
9294
  $ZodIntersection.init(inst, def);
9373
9295
  ZodType.init(inst, def);
@@ -9627,10 +9549,6 @@ function pipe(in_, out) {
9627
9549
  out
9628
9550
  });
9629
9551
  }
9630
- const ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
9631
- ZodPipe.init(inst, def);
9632
- $ZodPreprocess.init(inst, def);
9633
- });
9634
9552
  const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
9635
9553
  $ZodReadonly.init(inst, def);
9636
9554
  ZodType.init(inst, def);
@@ -9689,13 +9607,6 @@ function _instanceof(cls, params = {}) {
9689
9607
  };
9690
9608
  return inst;
9691
9609
  }
9692
- function preprocess(fn, schema) {
9693
- return new ZodPreprocess({
9694
- type: "pipe",
9695
- in: transform(fn),
9696
- out: schema
9697
- });
9698
- }
9699
9610
  //#endregion
9700
9611
  //#region ../schema-compat/dist/zod-to-json.js
9701
9612
  const PATCHED = Symbol("__mastra_patched__");
@@ -20403,12 +20314,12 @@ var ClientOrServerImplementationSchema = object$1({
20403
20314
  version: string()
20404
20315
  }).passthrough();
20405
20316
  var BaseParamsSchema = object$1({ _meta: optional(object$1({}).passthrough()) }).passthrough();
20406
- var ResultSchema$1 = BaseParamsSchema;
20407
- var RequestSchema$1 = object$1({
20317
+ var ResultSchema = BaseParamsSchema;
20318
+ var RequestSchema = object$1({
20408
20319
  method: string(),
20409
20320
  params: optional(BaseParamsSchema)
20410
20321
  });
20411
- var ServerCapabilitiesSchema$1 = object$1({
20322
+ var ServerCapabilitiesSchema = object$1({
20412
20323
  experimental: optional(object$1({}).passthrough()),
20413
20324
  logging: optional(object$1({}).passthrough()),
20414
20325
  prompts: optional(object$1({ listChanged: optional(boolean()) }).passthrough()),
@@ -20418,14 +20329,14 @@ var ServerCapabilitiesSchema$1 = object$1({
20418
20329
  }).passthrough()),
20419
20330
  tools: optional(object$1({ listChanged: optional(boolean()) }).passthrough())
20420
20331
  }).passthrough();
20421
- ResultSchema$1.extend({
20332
+ ResultSchema.extend({
20422
20333
  protocolVersion: string(),
20423
- capabilities: ServerCapabilitiesSchema$1,
20334
+ capabilities: ServerCapabilitiesSchema,
20424
20335
  serverInfo: ClientOrServerImplementationSchema,
20425
20336
  instructions: optional(string())
20426
20337
  });
20427
- var PaginatedResultSchema$1 = ResultSchema$1.extend({ nextCursor: optional(string()) });
20428
- var ToolSchema$1 = object$1({
20338
+ var PaginatedResultSchema = ResultSchema.extend({ nextCursor: optional(string()) });
20339
+ var ToolSchema = object$1({
20429
20340
  name: string(),
20430
20341
  description: optional(string()),
20431
20342
  inputSchema: object$1({
@@ -20433,17 +20344,17 @@ var ToolSchema$1 = object$1({
20433
20344
  properties: optional(object$1({}).passthrough())
20434
20345
  }).passthrough()
20435
20346
  }).passthrough();
20436
- PaginatedResultSchema$1.extend({ tools: array(ToolSchema$1) });
20437
- var TextContentSchema$1 = object$1({
20347
+ PaginatedResultSchema.extend({ tools: array(ToolSchema) });
20348
+ var TextContentSchema = object$1({
20438
20349
  type: literal("text"),
20439
20350
  text: string()
20440
20351
  }).passthrough();
20441
- var ImageContentSchema$1 = object$1({
20352
+ var ImageContentSchema = object$1({
20442
20353
  type: literal("image"),
20443
20354
  data: string().base64(),
20444
20355
  mimeType: string()
20445
20356
  }).passthrough();
20446
- var ResourceContentsSchema$1 = object$1({
20357
+ var ResourceContentsSchema = object$1({
20447
20358
  /**
20448
20359
  * The URI of this resource.
20449
20360
  */
@@ -20453,32 +20364,32 @@ var ResourceContentsSchema$1 = object$1({
20453
20364
  */
20454
20365
  mimeType: optional(string())
20455
20366
  }).passthrough();
20456
- var TextResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ text: string() });
20457
- var BlobResourceContentsSchema$1 = ResourceContentsSchema$1.extend({ blob: string().base64() });
20458
- var EmbeddedResourceSchema$1 = object$1({
20367
+ var TextResourceContentsSchema = ResourceContentsSchema.extend({ text: string() });
20368
+ var BlobResourceContentsSchema = ResourceContentsSchema.extend({ blob: string().base64() });
20369
+ var EmbeddedResourceSchema = object$1({
20459
20370
  type: literal("resource"),
20460
- resource: union([TextResourceContentsSchema$1, BlobResourceContentsSchema$1])
20371
+ resource: union([TextResourceContentsSchema, BlobResourceContentsSchema])
20461
20372
  }).passthrough();
20462
- ResultSchema$1.extend({
20373
+ ResultSchema.extend({
20463
20374
  content: array(union([
20464
- TextContentSchema$1,
20465
- ImageContentSchema$1,
20466
- EmbeddedResourceSchema$1
20375
+ TextContentSchema,
20376
+ ImageContentSchema,
20377
+ EmbeddedResourceSchema
20467
20378
  ])),
20468
20379
  isError: boolean().default(false).optional()
20469
- }).or(ResultSchema$1.extend({ toolResult: unknown() }));
20470
- var JSONRPC_VERSION$1 = "2.0";
20471
- var JSONRPCRequestSchema$1 = object$1({
20472
- jsonrpc: literal(JSONRPC_VERSION$1),
20380
+ }).or(ResultSchema.extend({ toolResult: unknown() }));
20381
+ var JSONRPC_VERSION = "2.0";
20382
+ var JSONRPCRequestSchema = object$1({
20383
+ jsonrpc: literal(JSONRPC_VERSION),
20473
20384
  id: union([string(), number().int()])
20474
- }).merge(RequestSchema$1).strict();
20475
- var JSONRPCResponseSchema$1 = object$1({
20476
- jsonrpc: literal(JSONRPC_VERSION$1),
20385
+ }).merge(RequestSchema).strict();
20386
+ var JSONRPCResponseSchema = object$1({
20387
+ jsonrpc: literal(JSONRPC_VERSION),
20477
20388
  id: union([string(), number().int()]),
20478
- result: ResultSchema$1
20389
+ result: ResultSchema
20479
20390
  }).strict();
20480
20391
  var JSONRPCErrorSchema = object$1({
20481
- jsonrpc: literal(JSONRPC_VERSION$1),
20392
+ jsonrpc: literal(JSONRPC_VERSION),
20482
20393
  id: union([string(), number().int()]),
20483
20394
  error: object$1({
20484
20395
  code: number().int(),
@@ -20487,12 +20398,12 @@ var JSONRPCErrorSchema = object$1({
20487
20398
  })
20488
20399
  }).strict();
20489
20400
  union([
20490
- JSONRPCRequestSchema$1,
20491
- object$1({ jsonrpc: literal(JSONRPC_VERSION$1) }).merge(object$1({
20401
+ JSONRPCRequestSchema,
20402
+ object$1({ jsonrpc: literal(JSONRPC_VERSION) }).merge(object$1({
20492
20403
  method: string(),
20493
20404
  params: optional(BaseParamsSchema)
20494
20405
  })).strict(),
20495
- JSONRPCResponseSchema$1,
20406
+ JSONRPCResponseSchema,
20496
20407
  JSONRPCErrorSchema
20497
20408
  ]);
20498
20409
  __export({}, {
@@ -24273,1837 +24184,6 @@ var streamSSE = (c, cb, onError) => {
24273
24184
  return c.newResponse(stream.responseReadable);
24274
24185
  };
24275
24186
  //#endregion
24276
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@modelcontextprotocol/sdk/1.29.0/7d2f0982429dbe53f84f7249d02074ef571f5d1c95137997d9ed2dfe102a137b/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
24277
- const RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
24278
- /**
24279
- * Assert 'object' type schema.
24280
- *
24281
- * @internal
24282
- */
24283
- const AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
24284
- /**
24285
- * A progress token, used to associate progress notifications with the original request.
24286
- */
24287
- const ProgressTokenSchema = union([string(), number().int()]);
24288
- /**
24289
- * An opaque token used to represent a cursor for pagination.
24290
- */
24291
- const CursorSchema = string();
24292
- looseObject({
24293
- /**
24294
- * Requested duration in milliseconds to retain task from creation.
24295
- */
24296
- ttl: number().optional(),
24297
- /**
24298
- * Time in milliseconds to wait between task status requests.
24299
- */
24300
- pollInterval: number().optional()
24301
- });
24302
- const TaskMetadataSchema = object$1({ ttl: number().optional() });
24303
- /**
24304
- * Metadata for associating messages with a task.
24305
- * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
24306
- */
24307
- const RelatedTaskMetadataSchema = object$1({ taskId: string() });
24308
- const RequestMetaSchema = looseObject({
24309
- /**
24310
- * 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.
24311
- */
24312
- progressToken: ProgressTokenSchema.optional(),
24313
- /**
24314
- * If specified, this request is related to the provided task.
24315
- */
24316
- [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()
24317
- });
24318
- /**
24319
- * Common params for any request.
24320
- */
24321
- const BaseRequestParamsSchema = object$1({
24322
- /**
24323
- * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
24324
- */
24325
- _meta: RequestMetaSchema.optional() });
24326
- /**
24327
- * Common params for any task-augmented request.
24328
- */
24329
- const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
24330
- /**
24331
- * If specified, the caller is requesting task-augmented execution for this request.
24332
- * The request will return a CreateTaskResult immediately, and the actual result can be
24333
- * retrieved later via tasks/result.
24334
- *
24335
- * Task augmentation is subject to capability negotiation - receivers MUST declare support
24336
- * for task augmentation of specific request types in their capabilities.
24337
- */
24338
- task: TaskMetadataSchema.optional() });
24339
- const RequestSchema = object$1({
24340
- method: string(),
24341
- params: BaseRequestParamsSchema.loose().optional()
24342
- });
24343
- const NotificationsParamsSchema = object$1({
24344
- /**
24345
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
24346
- * for notes on _meta usage.
24347
- */
24348
- _meta: RequestMetaSchema.optional() });
24349
- const NotificationSchema = object$1({
24350
- method: string(),
24351
- params: NotificationsParamsSchema.loose().optional()
24352
- });
24353
- const ResultSchema = looseObject({
24354
- /**
24355
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
24356
- * for notes on _meta usage.
24357
- */
24358
- _meta: RequestMetaSchema.optional() });
24359
- /**
24360
- * A uniquely identifying ID for a request in JSON-RPC.
24361
- */
24362
- const RequestIdSchema = union([string(), number().int()]);
24363
- /**
24364
- * A request that expects a response.
24365
- */
24366
- const JSONRPCRequestSchema = object$1({
24367
- jsonrpc: literal("2.0"),
24368
- id: RequestIdSchema,
24369
- ...RequestSchema.shape
24370
- }).strict();
24371
- /**
24372
- * A notification which does not expect a response.
24373
- */
24374
- const JSONRPCNotificationSchema = object$1({
24375
- jsonrpc: literal("2.0"),
24376
- ...NotificationSchema.shape
24377
- }).strict();
24378
- /**
24379
- * A successful (non-error) response to a request.
24380
- */
24381
- const JSONRPCResultResponseSchema = object$1({
24382
- jsonrpc: literal("2.0"),
24383
- id: RequestIdSchema,
24384
- result: ResultSchema
24385
- }).strict();
24386
- /**
24387
- * Error codes defined by the JSON-RPC specification.
24388
- */
24389
- var ErrorCode;
24390
- (function(ErrorCode) {
24391
- ErrorCode[ErrorCode["ConnectionClosed"] = -32e3] = "ConnectionClosed";
24392
- ErrorCode[ErrorCode["RequestTimeout"] = -32001] = "RequestTimeout";
24393
- ErrorCode[ErrorCode["ParseError"] = -32700] = "ParseError";
24394
- ErrorCode[ErrorCode["InvalidRequest"] = -32600] = "InvalidRequest";
24395
- ErrorCode[ErrorCode["MethodNotFound"] = -32601] = "MethodNotFound";
24396
- ErrorCode[ErrorCode["InvalidParams"] = -32602] = "InvalidParams";
24397
- ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError";
24398
- ErrorCode[ErrorCode["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
24399
- })(ErrorCode || (ErrorCode = {}));
24400
- /**
24401
- * A response to a request that indicates an error occurred.
24402
- */
24403
- const JSONRPCErrorResponseSchema = object$1({
24404
- jsonrpc: literal("2.0"),
24405
- id: RequestIdSchema.optional(),
24406
- error: object$1({
24407
- /**
24408
- * The error type that occurred.
24409
- */
24410
- code: number().int(),
24411
- /**
24412
- * A short description of the error. The message SHOULD be limited to a concise single sentence.
24413
- */
24414
- message: string(),
24415
- /**
24416
- * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
24417
- */
24418
- data: unknown().optional()
24419
- })
24420
- }).strict();
24421
- const JSONRPCMessageSchema = union([
24422
- JSONRPCRequestSchema,
24423
- JSONRPCNotificationSchema,
24424
- JSONRPCResultResponseSchema,
24425
- JSONRPCErrorResponseSchema
24426
- ]);
24427
- union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
24428
- /**
24429
- * A response that indicates success but carries no data.
24430
- */
24431
- const EmptyResultSchema = ResultSchema.strict();
24432
- const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
24433
- /**
24434
- * The ID of the request to cancel.
24435
- *
24436
- * This MUST correspond to the ID of a request previously issued in the same direction.
24437
- */
24438
- requestId: RequestIdSchema.optional(),
24439
- /**
24440
- * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
24441
- */
24442
- reason: string().optional()
24443
- });
24444
- /**
24445
- * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
24446
- *
24447
- * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
24448
- *
24449
- * This notification indicates that the result will be unused, so any associated processing SHOULD cease.
24450
- *
24451
- * A client MUST NOT attempt to cancel its `initialize` request.
24452
- */
24453
- const CancelledNotificationSchema = NotificationSchema.extend({
24454
- method: literal("notifications/cancelled"),
24455
- params: CancelledNotificationParamsSchema
24456
- });
24457
- /**
24458
- * Base schema to add `icons` property.
24459
- *
24460
- */
24461
- const IconsSchema = object$1({
24462
- /**
24463
- * Optional set of sized icons that the client can display in a user interface.
24464
- *
24465
- * Clients that support rendering icons MUST support at least the following MIME types:
24466
- * - `image/png` - PNG images (safe, universal compatibility)
24467
- * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
24468
- *
24469
- * Clients that support rendering icons SHOULD also support:
24470
- * - `image/svg+xml` - SVG images (scalable but requires security precautions)
24471
- * - `image/webp` - WebP images (modern, efficient format)
24472
- */
24473
- icons: array(object$1({
24474
- /**
24475
- * URL or data URI for the icon.
24476
- */
24477
- src: string(),
24478
- /**
24479
- * Optional MIME type for the icon.
24480
- */
24481
- mimeType: string().optional(),
24482
- /**
24483
- * Optional array of strings that specify sizes at which the icon can be used.
24484
- * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
24485
- *
24486
- * If not provided, the client should assume that the icon can be used at any size.
24487
- */
24488
- sizes: array(string()).optional(),
24489
- /**
24490
- * Optional specifier for the theme this icon is designed for. `light` indicates
24491
- * the icon is designed to be used with a light background, and `dark` indicates
24492
- * the icon is designed to be used with a dark background.
24493
- *
24494
- * If not provided, the client should assume the icon can be used with any theme.
24495
- */
24496
- theme: _enum(["light", "dark"]).optional()
24497
- })).optional() });
24498
- /**
24499
- * Base metadata interface for common properties across resources, tools, prompts, and implementations.
24500
- */
24501
- const BaseMetadataSchema = object$1({
24502
- /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
24503
- name: string(),
24504
- /**
24505
- * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
24506
- * even by those unfamiliar with domain-specific terminology.
24507
- *
24508
- * If not provided, the name should be used for display (except for Tool,
24509
- * where `annotations.title` should be given precedence over using `name`,
24510
- * if present).
24511
- */
24512
- title: string().optional()
24513
- });
24514
- /**
24515
- * Describes the name and version of an MCP implementation.
24516
- */
24517
- const ImplementationSchema = BaseMetadataSchema.extend({
24518
- ...BaseMetadataSchema.shape,
24519
- ...IconsSchema.shape,
24520
- version: string(),
24521
- /**
24522
- * An optional URL of the website for this implementation.
24523
- */
24524
- websiteUrl: string().optional(),
24525
- /**
24526
- * An optional human-readable description of what this implementation does.
24527
- *
24528
- * This can be used by clients or servers to provide context about their purpose
24529
- * and capabilities. For example, a server might describe the types of resources
24530
- * or tools it provides, while a client might describe its intended use case.
24531
- */
24532
- description: string().optional()
24533
- });
24534
- const ElicitationCapabilitySchema = preprocess((value) => {
24535
- if (value && typeof value === "object" && !Array.isArray(value)) {
24536
- if (Object.keys(value).length === 0) return { form: {} };
24537
- }
24538
- return value;
24539
- }, intersection(object$1({
24540
- form: intersection(object$1({ applyDefaults: boolean().optional() }), record(string(), unknown())).optional(),
24541
- url: AssertObjectSchema.optional()
24542
- }), record(string(), unknown()).optional()));
24543
- /**
24544
- * Task capabilities for clients, indicating which request types support task creation.
24545
- */
24546
- const ClientTasksCapabilitySchema = looseObject({
24547
- /**
24548
- * Present if the client supports listing tasks.
24549
- */
24550
- list: AssertObjectSchema.optional(),
24551
- /**
24552
- * Present if the client supports cancelling tasks.
24553
- */
24554
- cancel: AssertObjectSchema.optional(),
24555
- /**
24556
- * Capabilities for task creation on specific request types.
24557
- */
24558
- requests: looseObject({
24559
- /**
24560
- * Task support for sampling requests.
24561
- */
24562
- sampling: looseObject({ createMessage: AssertObjectSchema.optional() }).optional(),
24563
- /**
24564
- * Task support for elicitation requests.
24565
- */
24566
- elicitation: looseObject({ create: AssertObjectSchema.optional() }).optional()
24567
- }).optional()
24568
- });
24569
- /**
24570
- * Task capabilities for servers, indicating which request types support task creation.
24571
- */
24572
- const ServerTasksCapabilitySchema = looseObject({
24573
- /**
24574
- * Present if the server supports listing tasks.
24575
- */
24576
- list: AssertObjectSchema.optional(),
24577
- /**
24578
- * Present if the server supports cancelling tasks.
24579
- */
24580
- cancel: AssertObjectSchema.optional(),
24581
- /**
24582
- * Capabilities for task creation on specific request types.
24583
- */
24584
- requests: looseObject({
24585
- /**
24586
- * Task support for tool requests.
24587
- */
24588
- tools: looseObject({ call: AssertObjectSchema.optional() }).optional() }).optional()
24589
- });
24590
- /**
24591
- * 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.
24592
- */
24593
- const ClientCapabilitiesSchema = object$1({
24594
- /**
24595
- * Experimental, non-standard capabilities that the client supports.
24596
- */
24597
- experimental: record(string(), AssertObjectSchema).optional(),
24598
- /**
24599
- * Present if the client supports sampling from an LLM.
24600
- */
24601
- sampling: object$1({
24602
- /**
24603
- * Present if the client supports context inclusion via includeContext parameter.
24604
- * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it).
24605
- */
24606
- context: AssertObjectSchema.optional(),
24607
- /**
24608
- * Present if the client supports tool use via tools and toolChoice parameters.
24609
- */
24610
- tools: AssertObjectSchema.optional()
24611
- }).optional(),
24612
- /**
24613
- * Present if the client supports eliciting user input.
24614
- */
24615
- elicitation: ElicitationCapabilitySchema.optional(),
24616
- /**
24617
- * Present if the client supports listing roots.
24618
- */
24619
- roots: object$1({
24620
- /**
24621
- * Whether the client supports issuing notifications for changes to the roots list.
24622
- */
24623
- listChanged: boolean().optional() }).optional(),
24624
- /**
24625
- * Present if the client supports task creation.
24626
- */
24627
- tasks: ClientTasksCapabilitySchema.optional(),
24628
- /**
24629
- * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
24630
- */
24631
- extensions: record(string(), AssertObjectSchema).optional()
24632
- });
24633
- const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
24634
- /**
24635
- * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
24636
- */
24637
- protocolVersion: string(),
24638
- capabilities: ClientCapabilitiesSchema,
24639
- clientInfo: ImplementationSchema
24640
- });
24641
- /**
24642
- * This request is sent from the client to the server when it first connects, asking it to begin initialization.
24643
- */
24644
- const InitializeRequestSchema = RequestSchema.extend({
24645
- method: literal("initialize"),
24646
- params: InitializeRequestParamsSchema
24647
- });
24648
- /**
24649
- * 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.
24650
- */
24651
- const ServerCapabilitiesSchema = object$1({
24652
- /**
24653
- * Experimental, non-standard capabilities that the server supports.
24654
- */
24655
- experimental: record(string(), AssertObjectSchema).optional(),
24656
- /**
24657
- * Present if the server supports sending log messages to the client.
24658
- */
24659
- logging: AssertObjectSchema.optional(),
24660
- /**
24661
- * Present if the server supports sending completions to the client.
24662
- */
24663
- completions: AssertObjectSchema.optional(),
24664
- /**
24665
- * Present if the server offers any prompt templates.
24666
- */
24667
- prompts: object$1({
24668
- /**
24669
- * Whether this server supports issuing notifications for changes to the prompt list.
24670
- */
24671
- listChanged: boolean().optional() }).optional(),
24672
- /**
24673
- * Present if the server offers any resources to read.
24674
- */
24675
- resources: object$1({
24676
- /**
24677
- * Whether this server supports clients subscribing to resource updates.
24678
- */
24679
- subscribe: boolean().optional(),
24680
- /**
24681
- * Whether this server supports issuing notifications for changes to the resource list.
24682
- */
24683
- listChanged: boolean().optional()
24684
- }).optional(),
24685
- /**
24686
- * Present if the server offers any tools to call.
24687
- */
24688
- tools: object$1({
24689
- /**
24690
- * Whether this server supports issuing notifications for changes to the tool list.
24691
- */
24692
- listChanged: boolean().optional() }).optional(),
24693
- /**
24694
- * Present if the server supports task creation.
24695
- */
24696
- tasks: ServerTasksCapabilitySchema.optional(),
24697
- /**
24698
- * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
24699
- */
24700
- extensions: record(string(), AssertObjectSchema).optional()
24701
- });
24702
- /**
24703
- * After receiving an initialize request from the client, the server sends this response.
24704
- */
24705
- const InitializeResultSchema = ResultSchema.extend({
24706
- /**
24707
- * 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.
24708
- */
24709
- protocolVersion: string(),
24710
- capabilities: ServerCapabilitiesSchema,
24711
- serverInfo: ImplementationSchema,
24712
- /**
24713
- * Instructions describing how to use the server and its features.
24714
- *
24715
- * 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.
24716
- */
24717
- instructions: string().optional()
24718
- });
24719
- /**
24720
- * This notification is sent from the client to the server after initialization has finished.
24721
- */
24722
- const InitializedNotificationSchema = NotificationSchema.extend({
24723
- method: literal("notifications/initialized"),
24724
- params: NotificationsParamsSchema.optional()
24725
- });
24726
- /**
24727
- * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
24728
- */
24729
- const PingRequestSchema = RequestSchema.extend({
24730
- method: literal("ping"),
24731
- params: BaseRequestParamsSchema.optional()
24732
- });
24733
- const ProgressSchema = object$1({
24734
- /**
24735
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
24736
- */
24737
- progress: number(),
24738
- /**
24739
- * Total number of items to process (or total progress required), if known.
24740
- */
24741
- total: optional(number()),
24742
- /**
24743
- * An optional message describing the current progress.
24744
- */
24745
- message: optional(string())
24746
- });
24747
- const ProgressNotificationParamsSchema = object$1({
24748
- ...NotificationsParamsSchema.shape,
24749
- ...ProgressSchema.shape,
24750
- /**
24751
- * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
24752
- */
24753
- progressToken: ProgressTokenSchema
24754
- });
24755
- /**
24756
- * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
24757
- *
24758
- * @category notifications/progress
24759
- */
24760
- const ProgressNotificationSchema = NotificationSchema.extend({
24761
- method: literal("notifications/progress"),
24762
- params: ProgressNotificationParamsSchema
24763
- });
24764
- const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
24765
- /**
24766
- * An opaque token representing the current pagination position.
24767
- * If provided, the server should return results starting after this cursor.
24768
- */
24769
- cursor: CursorSchema.optional() });
24770
- const PaginatedRequestSchema = RequestSchema.extend({ params: PaginatedRequestParamsSchema.optional() });
24771
- const PaginatedResultSchema = ResultSchema.extend({
24772
- /**
24773
- * An opaque token representing the pagination position after the last returned result.
24774
- * If present, there may be more results available.
24775
- */
24776
- nextCursor: CursorSchema.optional() });
24777
- /**
24778
- * The status of a task.
24779
- * */
24780
- const TaskStatusSchema = _enum([
24781
- "working",
24782
- "input_required",
24783
- "completed",
24784
- "failed",
24785
- "cancelled"
24786
- ]);
24787
- /**
24788
- * A pollable state object associated with a request.
24789
- */
24790
- const TaskSchema = object$1({
24791
- taskId: string(),
24792
- status: TaskStatusSchema,
24793
- /**
24794
- * Time in milliseconds to keep task results available after completion.
24795
- * If null, the task has unlimited lifetime until manually cleaned up.
24796
- */
24797
- ttl: union([number(), _null()]),
24798
- /**
24799
- * ISO 8601 timestamp when the task was created.
24800
- */
24801
- createdAt: string(),
24802
- /**
24803
- * ISO 8601 timestamp when the task was last updated.
24804
- */
24805
- lastUpdatedAt: string(),
24806
- pollInterval: optional(number()),
24807
- /**
24808
- * Optional diagnostic message for failed tasks or other status information.
24809
- */
24810
- statusMessage: optional(string())
24811
- });
24812
- /**
24813
- * Result returned when a task is created, containing the task data wrapped in a task field.
24814
- */
24815
- const CreateTaskResultSchema = ResultSchema.extend({ task: TaskSchema });
24816
- /**
24817
- * Parameters for task status notification.
24818
- */
24819
- const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);
24820
- /**
24821
- * A notification sent when a task's status changes.
24822
- */
24823
- const TaskStatusNotificationSchema = NotificationSchema.extend({
24824
- method: literal("notifications/tasks/status"),
24825
- params: TaskStatusNotificationParamsSchema
24826
- });
24827
- /**
24828
- * A request to get the state of a specific task.
24829
- */
24830
- const GetTaskRequestSchema = RequestSchema.extend({
24831
- method: literal("tasks/get"),
24832
- params: BaseRequestParamsSchema.extend({ taskId: string() })
24833
- });
24834
- /**
24835
- * The response to a tasks/get request.
24836
- */
24837
- const GetTaskResultSchema = ResultSchema.merge(TaskSchema);
24838
- /**
24839
- * A request to get the result of a specific task.
24840
- */
24841
- const GetTaskPayloadRequestSchema = RequestSchema.extend({
24842
- method: literal("tasks/result"),
24843
- params: BaseRequestParamsSchema.extend({ taskId: string() })
24844
- });
24845
- ResultSchema.loose();
24846
- /**
24847
- * A request to list tasks.
24848
- */
24849
- const ListTasksRequestSchema = PaginatedRequestSchema.extend({ method: literal("tasks/list") });
24850
- /**
24851
- * The response to a tasks/list request.
24852
- */
24853
- const ListTasksResultSchema = PaginatedResultSchema.extend({ tasks: array(TaskSchema) });
24854
- /**
24855
- * A request to cancel a specific task.
24856
- */
24857
- const CancelTaskRequestSchema = RequestSchema.extend({
24858
- method: literal("tasks/cancel"),
24859
- params: BaseRequestParamsSchema.extend({ taskId: string() })
24860
- });
24861
- ResultSchema.merge(TaskSchema);
24862
- /**
24863
- * The contents of a specific resource or sub-resource.
24864
- */
24865
- const ResourceContentsSchema = object$1({
24866
- /**
24867
- * The URI of this resource.
24868
- */
24869
- uri: string(),
24870
- /**
24871
- * The MIME type of this resource, if known.
24872
- */
24873
- mimeType: optional(string()),
24874
- /**
24875
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
24876
- * for notes on _meta usage.
24877
- */
24878
- _meta: record(string(), unknown()).optional()
24879
- });
24880
- const TextResourceContentsSchema = ResourceContentsSchema.extend({
24881
- /**
24882
- * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
24883
- */
24884
- text: string() });
24885
- /**
24886
- * A Zod schema for validating Base64 strings that is more performant and
24887
- * robust for very large inputs than the default regex-based check. It avoids
24888
- * stack overflows by using the native `atob` function for validation.
24889
- */
24890
- const Base64Schema = string().refine((val) => {
24891
- try {
24892
- atob(val);
24893
- return true;
24894
- } catch {
24895
- return false;
24896
- }
24897
- }, { message: "Invalid Base64 string" });
24898
- const BlobResourceContentsSchema = ResourceContentsSchema.extend({
24899
- /**
24900
- * A base64-encoded string representing the binary data of the item.
24901
- */
24902
- blob: Base64Schema });
24903
- /**
24904
- * The sender or recipient of messages and data in a conversation.
24905
- */
24906
- const RoleSchema = _enum(["user", "assistant"]);
24907
- /**
24908
- * Optional annotations providing clients additional context about a resource.
24909
- */
24910
- const AnnotationsSchema = object$1({
24911
- /**
24912
- * Intended audience(s) for the resource.
24913
- */
24914
- audience: array(RoleSchema).optional(),
24915
- /**
24916
- * Importance hint for the resource, from 0 (least) to 1 (most).
24917
- */
24918
- priority: number().min(0).max(1).optional(),
24919
- /**
24920
- * ISO 8601 timestamp for the most recent modification.
24921
- */
24922
- lastModified: datetime({ offset: true }).optional()
24923
- });
24924
- /**
24925
- * A known resource that the server is capable of reading.
24926
- */
24927
- const ResourceSchema = object$1({
24928
- ...BaseMetadataSchema.shape,
24929
- ...IconsSchema.shape,
24930
- /**
24931
- * The URI of this resource.
24932
- */
24933
- uri: string(),
24934
- /**
24935
- * A description of what this resource represents.
24936
- *
24937
- * 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.
24938
- */
24939
- description: optional(string()),
24940
- /**
24941
- * The MIME type of this resource, if known.
24942
- */
24943
- mimeType: optional(string()),
24944
- /**
24945
- * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
24946
- *
24947
- * This can be used by Hosts to display file sizes and estimate context window usage.
24948
- */
24949
- size: optional(number()),
24950
- /**
24951
- * Optional annotations for the client.
24952
- */
24953
- annotations: AnnotationsSchema.optional(),
24954
- /**
24955
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
24956
- * for notes on _meta usage.
24957
- */
24958
- _meta: optional(looseObject({}))
24959
- });
24960
- /**
24961
- * A template description for resources available on the server.
24962
- */
24963
- const ResourceTemplateSchema = object$1({
24964
- ...BaseMetadataSchema.shape,
24965
- ...IconsSchema.shape,
24966
- /**
24967
- * A URI template (according to RFC 6570) that can be used to construct resource URIs.
24968
- */
24969
- uriTemplate: string(),
24970
- /**
24971
- * A description of what this template is for.
24972
- *
24973
- * 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.
24974
- */
24975
- description: optional(string()),
24976
- /**
24977
- * 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.
24978
- */
24979
- mimeType: optional(string()),
24980
- /**
24981
- * Optional annotations for the client.
24982
- */
24983
- annotations: AnnotationsSchema.optional(),
24984
- /**
24985
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
24986
- * for notes on _meta usage.
24987
- */
24988
- _meta: optional(looseObject({}))
24989
- });
24990
- /**
24991
- * Sent from the client to request a list of resources the server has.
24992
- */
24993
- const ListResourcesRequestSchema = PaginatedRequestSchema.extend({ method: literal("resources/list") });
24994
- /**
24995
- * The server's response to a resources/list request from the client.
24996
- */
24997
- const ListResourcesResultSchema = PaginatedResultSchema.extend({ resources: array(ResourceSchema) });
24998
- /**
24999
- * Sent from the client to request a list of resource templates the server has.
25000
- */
25001
- const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ method: literal("resources/templates/list") });
25002
- /**
25003
- * The server's response to a resources/templates/list request from the client.
25004
- */
25005
- const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({ resourceTemplates: array(ResourceTemplateSchema) });
25006
- const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
25007
- /**
25008
- * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
25009
- *
25010
- * @format uri
25011
- */
25012
- uri: string() });
25013
- /**
25014
- * Parameters for a `resources/read` request.
25015
- */
25016
- const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
25017
- /**
25018
- * Sent from the client to the server, to read a specific resource URI.
25019
- */
25020
- const ReadResourceRequestSchema = RequestSchema.extend({
25021
- method: literal("resources/read"),
25022
- params: ReadResourceRequestParamsSchema
25023
- });
25024
- /**
25025
- * The server's response to a resources/read request from the client.
25026
- */
25027
- const ReadResourceResultSchema = ResultSchema.extend({ contents: array(union([TextResourceContentsSchema, BlobResourceContentsSchema])) });
25028
- /**
25029
- * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
25030
- */
25031
- const ResourceListChangedNotificationSchema = NotificationSchema.extend({
25032
- method: literal("notifications/resources/list_changed"),
25033
- params: NotificationsParamsSchema.optional()
25034
- });
25035
- const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
25036
- /**
25037
- * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
25038
- */
25039
- const SubscribeRequestSchema = RequestSchema.extend({
25040
- method: literal("resources/subscribe"),
25041
- params: SubscribeRequestParamsSchema
25042
- });
25043
- const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
25044
- /**
25045
- * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
25046
- */
25047
- const UnsubscribeRequestSchema = RequestSchema.extend({
25048
- method: literal("resources/unsubscribe"),
25049
- params: UnsubscribeRequestParamsSchema
25050
- });
25051
- /**
25052
- * Parameters for a `notifications/resources/updated` notification.
25053
- */
25054
- const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
25055
- /**
25056
- * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
25057
- */
25058
- uri: string() });
25059
- /**
25060
- * 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.
25061
- */
25062
- const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
25063
- method: literal("notifications/resources/updated"),
25064
- params: ResourceUpdatedNotificationParamsSchema
25065
- });
25066
- /**
25067
- * Describes an argument that a prompt can accept.
25068
- */
25069
- const PromptArgumentSchema = object$1({
25070
- /**
25071
- * The name of the argument.
25072
- */
25073
- name: string(),
25074
- /**
25075
- * A human-readable description of the argument.
25076
- */
25077
- description: optional(string()),
25078
- /**
25079
- * Whether this argument must be provided.
25080
- */
25081
- required: optional(boolean())
25082
- });
25083
- /**
25084
- * A prompt or prompt template that the server offers.
25085
- */
25086
- const PromptSchema$1 = object$1({
25087
- ...BaseMetadataSchema.shape,
25088
- ...IconsSchema.shape,
25089
- /**
25090
- * An optional description of what this prompt provides
25091
- */
25092
- description: optional(string()),
25093
- /**
25094
- * A list of arguments to use for templating the prompt.
25095
- */
25096
- arguments: optional(array(PromptArgumentSchema)),
25097
- /**
25098
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25099
- * for notes on _meta usage.
25100
- */
25101
- _meta: optional(looseObject({}))
25102
- });
25103
- /**
25104
- * Sent from the client to request a list of prompts and prompt templates the server has.
25105
- */
25106
- const ListPromptsRequestSchema = PaginatedRequestSchema.extend({ method: literal("prompts/list") });
25107
- /**
25108
- * The server's response to a prompts/list request from the client.
25109
- */
25110
- const ListPromptsResultSchema = PaginatedResultSchema.extend({ prompts: array(PromptSchema$1) });
25111
- /**
25112
- * Parameters for a `prompts/get` request.
25113
- */
25114
- const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
25115
- /**
25116
- * The name of the prompt or prompt template.
25117
- */
25118
- name: string(),
25119
- /**
25120
- * Arguments to use for templating the prompt.
25121
- */
25122
- arguments: record(string(), string()).optional()
25123
- });
25124
- /**
25125
- * Used by the client to get a prompt provided by the server.
25126
- */
25127
- const GetPromptRequestSchema = RequestSchema.extend({
25128
- method: literal("prompts/get"),
25129
- params: GetPromptRequestParamsSchema
25130
- });
25131
- /**
25132
- * Text provided to or from an LLM.
25133
- */
25134
- const TextContentSchema = object$1({
25135
- type: literal("text"),
25136
- /**
25137
- * The text content of the message.
25138
- */
25139
- text: string(),
25140
- /**
25141
- * Optional annotations for the client.
25142
- */
25143
- annotations: AnnotationsSchema.optional(),
25144
- /**
25145
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25146
- * for notes on _meta usage.
25147
- */
25148
- _meta: record(string(), unknown()).optional()
25149
- });
25150
- /**
25151
- * An image provided to or from an LLM.
25152
- */
25153
- const ImageContentSchema = object$1({
25154
- type: literal("image"),
25155
- /**
25156
- * The base64-encoded image data.
25157
- */
25158
- data: Base64Schema,
25159
- /**
25160
- * The MIME type of the image. Different providers may support different image types.
25161
- */
25162
- mimeType: string(),
25163
- /**
25164
- * Optional annotations for the client.
25165
- */
25166
- annotations: AnnotationsSchema.optional(),
25167
- /**
25168
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25169
- * for notes on _meta usage.
25170
- */
25171
- _meta: record(string(), unknown()).optional()
25172
- });
25173
- /**
25174
- * An Audio provided to or from an LLM.
25175
- */
25176
- const AudioContentSchema = object$1({
25177
- type: literal("audio"),
25178
- /**
25179
- * The base64-encoded audio data.
25180
- */
25181
- data: Base64Schema,
25182
- /**
25183
- * The MIME type of the audio. Different providers may support different audio types.
25184
- */
25185
- mimeType: string(),
25186
- /**
25187
- * Optional annotations for the client.
25188
- */
25189
- annotations: AnnotationsSchema.optional(),
25190
- /**
25191
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25192
- * for notes on _meta usage.
25193
- */
25194
- _meta: record(string(), unknown()).optional()
25195
- });
25196
- /**
25197
- * A tool call request from an assistant (LLM).
25198
- * Represents the assistant's request to use a tool.
25199
- */
25200
- const ToolUseContentSchema = object$1({
25201
- type: literal("tool_use"),
25202
- /**
25203
- * The name of the tool to invoke.
25204
- * Must match a tool name from the request's tools array.
25205
- */
25206
- name: string(),
25207
- /**
25208
- * Unique identifier for this tool call.
25209
- * Used to correlate with ToolResultContent in subsequent messages.
25210
- */
25211
- id: string(),
25212
- /**
25213
- * Arguments to pass to the tool.
25214
- * Must conform to the tool's inputSchema.
25215
- */
25216
- input: record(string(), unknown()),
25217
- /**
25218
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25219
- * for notes on _meta usage.
25220
- */
25221
- _meta: record(string(), unknown()).optional()
25222
- });
25223
- /**
25224
- * The contents of a resource, embedded into a prompt or tool call result.
25225
- */
25226
- const EmbeddedResourceSchema = object$1({
25227
- type: literal("resource"),
25228
- resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]),
25229
- /**
25230
- * Optional annotations for the client.
25231
- */
25232
- annotations: AnnotationsSchema.optional(),
25233
- /**
25234
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25235
- * for notes on _meta usage.
25236
- */
25237
- _meta: record(string(), unknown()).optional()
25238
- });
25239
- /**
25240
- * A content block that can be used in prompts and tool results.
25241
- */
25242
- const ContentBlockSchema = union([
25243
- TextContentSchema,
25244
- ImageContentSchema,
25245
- AudioContentSchema,
25246
- ResourceSchema.extend({ type: literal("resource_link") }),
25247
- EmbeddedResourceSchema
25248
- ]);
25249
- /**
25250
- * Describes a message returned as part of a prompt.
25251
- */
25252
- const PromptMessageSchema = object$1({
25253
- role: RoleSchema,
25254
- content: ContentBlockSchema
25255
- });
25256
- /**
25257
- * The server's response to a prompts/get request from the client.
25258
- */
25259
- const GetPromptResultSchema = ResultSchema.extend({
25260
- /**
25261
- * An optional description for the prompt.
25262
- */
25263
- description: string().optional(),
25264
- messages: array(PromptMessageSchema)
25265
- });
25266
- /**
25267
- * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
25268
- */
25269
- const PromptListChangedNotificationSchema = NotificationSchema.extend({
25270
- method: literal("notifications/prompts/list_changed"),
25271
- params: NotificationsParamsSchema.optional()
25272
- });
25273
- /**
25274
- * Additional properties describing a Tool to clients.
25275
- *
25276
- * NOTE: all properties in ToolAnnotations are **hints**.
25277
- * They are not guaranteed to provide a faithful description of
25278
- * tool behavior (including descriptive properties like `title`).
25279
- *
25280
- * Clients should never make tool use decisions based on ToolAnnotations
25281
- * received from untrusted servers.
25282
- */
25283
- const ToolAnnotationsSchema = object$1({
25284
- /**
25285
- * A human-readable title for the tool.
25286
- */
25287
- title: string().optional(),
25288
- /**
25289
- * If true, the tool does not modify its environment.
25290
- *
25291
- * Default: false
25292
- */
25293
- readOnlyHint: boolean().optional(),
25294
- /**
25295
- * If true, the tool may perform destructive updates to its environment.
25296
- * If false, the tool performs only additive updates.
25297
- *
25298
- * (This property is meaningful only when `readOnlyHint == false`)
25299
- *
25300
- * Default: true
25301
- */
25302
- destructiveHint: boolean().optional(),
25303
- /**
25304
- * If true, calling the tool repeatedly with the same arguments
25305
- * will have no additional effect on the its environment.
25306
- *
25307
- * (This property is meaningful only when `readOnlyHint == false`)
25308
- *
25309
- * Default: false
25310
- */
25311
- idempotentHint: boolean().optional(),
25312
- /**
25313
- * If true, this tool may interact with an "open world" of external
25314
- * entities. If false, the tool's domain of interaction is closed.
25315
- * For example, the world of a web search tool is open, whereas that
25316
- * of a memory tool is not.
25317
- *
25318
- * Default: true
25319
- */
25320
- openWorldHint: boolean().optional()
25321
- });
25322
- /**
25323
- * Execution-related properties for a tool.
25324
- */
25325
- const ToolExecutionSchema = object$1({
25326
- /**
25327
- * Indicates the tool's preference for task-augmented execution.
25328
- * - "required": Clients MUST invoke the tool as a task
25329
- * - "optional": Clients MAY invoke the tool as a task or normal request
25330
- * - "forbidden": Clients MUST NOT attempt to invoke the tool as a task
25331
- *
25332
- * If not present, defaults to "forbidden".
25333
- */
25334
- taskSupport: _enum([
25335
- "required",
25336
- "optional",
25337
- "forbidden"
25338
- ]).optional() });
25339
- /**
25340
- * Definition for a tool the client can call.
25341
- */
25342
- const ToolSchema = object$1({
25343
- ...BaseMetadataSchema.shape,
25344
- ...IconsSchema.shape,
25345
- /**
25346
- * A human-readable description of the tool.
25347
- */
25348
- description: string().optional(),
25349
- /**
25350
- * A JSON Schema 2020-12 object defining the expected parameters for the tool.
25351
- * Must have type: 'object' at the root level per MCP spec.
25352
- */
25353
- inputSchema: object$1({
25354
- type: literal("object"),
25355
- properties: record(string(), AssertObjectSchema).optional(),
25356
- required: array(string()).optional()
25357
- }).catchall(unknown()),
25358
- /**
25359
- * An optional JSON Schema 2020-12 object defining the structure of the tool's output
25360
- * returned in the structuredContent field of a CallToolResult.
25361
- * Must have type: 'object' at the root level per MCP spec.
25362
- */
25363
- outputSchema: object$1({
25364
- type: literal("object"),
25365
- properties: record(string(), AssertObjectSchema).optional(),
25366
- required: array(string()).optional()
25367
- }).catchall(unknown()).optional(),
25368
- /**
25369
- * Optional additional tool information.
25370
- */
25371
- annotations: ToolAnnotationsSchema.optional(),
25372
- /**
25373
- * Execution-related properties for this tool.
25374
- */
25375
- execution: ToolExecutionSchema.optional(),
25376
- /**
25377
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25378
- * for notes on _meta usage.
25379
- */
25380
- _meta: record(string(), unknown()).optional()
25381
- });
25382
- /**
25383
- * Sent from the client to request a list of tools the server has.
25384
- */
25385
- const ListToolsRequestSchema = PaginatedRequestSchema.extend({ method: literal("tools/list") });
25386
- /**
25387
- * The server's response to a tools/list request from the client.
25388
- */
25389
- const ListToolsResultSchema = PaginatedResultSchema.extend({ tools: array(ToolSchema) });
25390
- /**
25391
- * The server's response to a tool call.
25392
- */
25393
- const CallToolResultSchema = ResultSchema.extend({
25394
- /**
25395
- * A list of content objects that represent the result of the tool call.
25396
- *
25397
- * If the Tool does not define an outputSchema, this field MUST be present in the result.
25398
- * For backwards compatibility, this field is always present, but it may be empty.
25399
- */
25400
- content: array(ContentBlockSchema).default([]),
25401
- /**
25402
- * An object containing structured tool output.
25403
- *
25404
- * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
25405
- */
25406
- structuredContent: record(string(), unknown()).optional(),
25407
- /**
25408
- * Whether the tool call ended in an error.
25409
- *
25410
- * If not set, this is assumed to be false (the call was successful).
25411
- *
25412
- * Any errors that originate from the tool SHOULD be reported inside the result
25413
- * object, with `isError` set to true, _not_ as an MCP protocol-level error
25414
- * response. Otherwise, the LLM would not be able to see that an error occurred
25415
- * and self-correct.
25416
- *
25417
- * However, any errors in _finding_ the tool, an error indicating that the
25418
- * server does not support tool calls, or any other exceptional conditions,
25419
- * should be reported as an MCP error response.
25420
- */
25421
- isError: boolean().optional()
25422
- });
25423
- CallToolResultSchema.or(ResultSchema.extend({ toolResult: unknown() }));
25424
- /**
25425
- * Parameters for a `tools/call` request.
25426
- */
25427
- const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
25428
- /**
25429
- * The name of the tool to call.
25430
- */
25431
- name: string(),
25432
- /**
25433
- * Arguments to pass to the tool.
25434
- */
25435
- arguments: record(string(), unknown()).optional()
25436
- });
25437
- /**
25438
- * Used by the client to invoke a tool provided by the server.
25439
- */
25440
- const CallToolRequestSchema = RequestSchema.extend({
25441
- method: literal("tools/call"),
25442
- params: CallToolRequestParamsSchema
25443
- });
25444
- /**
25445
- * 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.
25446
- */
25447
- const ToolListChangedNotificationSchema = NotificationSchema.extend({
25448
- method: literal("notifications/tools/list_changed"),
25449
- params: NotificationsParamsSchema.optional()
25450
- });
25451
- object$1({
25452
- /**
25453
- * If true, the list will be refreshed automatically when a list changed notification is received.
25454
- * The callback will be called with the updated list.
25455
- *
25456
- * If false, the callback will be called with null items, allowing manual refresh.
25457
- *
25458
- * @default true
25459
- */
25460
- autoRefresh: boolean().default(true),
25461
- /**
25462
- * Debounce time in milliseconds for list changed notification processing.
25463
- *
25464
- * Multiple notifications received within this timeframe will only trigger one refresh.
25465
- * Set to 0 to disable debouncing.
25466
- *
25467
- * @default 300
25468
- */
25469
- debounceMs: number().int().nonnegative().default(300)
25470
- });
25471
- /**
25472
- * The severity of a log message.
25473
- */
25474
- const LoggingLevelSchema = _enum([
25475
- "debug",
25476
- "info",
25477
- "notice",
25478
- "warning",
25479
- "error",
25480
- "critical",
25481
- "alert",
25482
- "emergency"
25483
- ]);
25484
- /**
25485
- * Parameters for a `logging/setLevel` request.
25486
- */
25487
- const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
25488
- /**
25489
- * 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.
25490
- */
25491
- level: LoggingLevelSchema });
25492
- /**
25493
- * A request from the client to the server, to enable or adjust logging.
25494
- */
25495
- const SetLevelRequestSchema = RequestSchema.extend({
25496
- method: literal("logging/setLevel"),
25497
- params: SetLevelRequestParamsSchema
25498
- });
25499
- /**
25500
- * Parameters for a `notifications/message` notification.
25501
- */
25502
- const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
25503
- /**
25504
- * The severity of this log message.
25505
- */
25506
- level: LoggingLevelSchema,
25507
- /**
25508
- * An optional name of the logger issuing this message.
25509
- */
25510
- logger: string().optional(),
25511
- /**
25512
- * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
25513
- */
25514
- data: unknown()
25515
- });
25516
- /**
25517
- * 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.
25518
- */
25519
- const LoggingMessageNotificationSchema = NotificationSchema.extend({
25520
- method: literal("notifications/message"),
25521
- params: LoggingMessageNotificationParamsSchema
25522
- });
25523
- /**
25524
- * The server's preferences for model selection, requested of the client during sampling.
25525
- */
25526
- const ModelPreferencesSchema = object$1({
25527
- /**
25528
- * Optional hints to use for model selection.
25529
- */
25530
- hints: array(object$1({
25531
- /**
25532
- * A hint for a model name.
25533
- */
25534
- name: string().optional() })).optional(),
25535
- /**
25536
- * How much to prioritize cost when selecting a model.
25537
- */
25538
- costPriority: number().min(0).max(1).optional(),
25539
- /**
25540
- * How much to prioritize sampling speed (latency) when selecting a model.
25541
- */
25542
- speedPriority: number().min(0).max(1).optional(),
25543
- /**
25544
- * How much to prioritize intelligence and capabilities when selecting a model.
25545
- */
25546
- intelligencePriority: number().min(0).max(1).optional()
25547
- });
25548
- /**
25549
- * Controls tool usage behavior in sampling requests.
25550
- */
25551
- const ToolChoiceSchema = object$1({
25552
- /**
25553
- * Controls when tools are used:
25554
- * - "auto": Model decides whether to use tools (default)
25555
- * - "required": Model MUST use at least one tool before completing
25556
- * - "none": Model MUST NOT use any tools
25557
- */
25558
- mode: _enum([
25559
- "auto",
25560
- "required",
25561
- "none"
25562
- ]).optional() });
25563
- /**
25564
- * The result of a tool execution, provided by the user (server).
25565
- * Represents the outcome of invoking a tool requested via ToolUseContent.
25566
- */
25567
- const ToolResultContentSchema = object$1({
25568
- type: literal("tool_result"),
25569
- toolUseId: string().describe("The unique identifier for the corresponding tool call."),
25570
- content: array(ContentBlockSchema).default([]),
25571
- structuredContent: object$1({}).loose().optional(),
25572
- isError: boolean().optional(),
25573
- /**
25574
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25575
- * for notes on _meta usage.
25576
- */
25577
- _meta: record(string(), unknown()).optional()
25578
- });
25579
- /**
25580
- * Basic content types for sampling responses (without tool use).
25581
- * Used for backwards-compatible CreateMessageResult when tools are not used.
25582
- */
25583
- const SamplingContentSchema = discriminatedUnion("type", [
25584
- TextContentSchema,
25585
- ImageContentSchema,
25586
- AudioContentSchema
25587
- ]);
25588
- /**
25589
- * Content block types allowed in sampling messages.
25590
- * This includes text, image, audio, tool use requests, and tool results.
25591
- */
25592
- const SamplingMessageContentBlockSchema = discriminatedUnion("type", [
25593
- TextContentSchema,
25594
- ImageContentSchema,
25595
- AudioContentSchema,
25596
- ToolUseContentSchema,
25597
- ToolResultContentSchema
25598
- ]);
25599
- /**
25600
- * Describes a message issued to or received from an LLM API.
25601
- */
25602
- const SamplingMessageSchema = object$1({
25603
- role: RoleSchema,
25604
- content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]),
25605
- /**
25606
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
25607
- * for notes on _meta usage.
25608
- */
25609
- _meta: record(string(), unknown()).optional()
25610
- });
25611
- /**
25612
- * Parameters for a `sampling/createMessage` request.
25613
- */
25614
- const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({
25615
- messages: array(SamplingMessageSchema),
25616
- /**
25617
- * The server's preferences for which model to select. The client MAY modify or omit this request.
25618
- */
25619
- modelPreferences: ModelPreferencesSchema.optional(),
25620
- /**
25621
- * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
25622
- */
25623
- systemPrompt: string().optional(),
25624
- /**
25625
- * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
25626
- * The client MAY ignore this request.
25627
- *
25628
- * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client
25629
- * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
25630
- */
25631
- includeContext: _enum([
25632
- "none",
25633
- "thisServer",
25634
- "allServers"
25635
- ]).optional(),
25636
- temperature: number().optional(),
25637
- /**
25638
- * The requested maximum number of tokens to sample (to prevent runaway completions).
25639
- *
25640
- * The client MAY choose to sample fewer tokens than the requested maximum.
25641
- */
25642
- maxTokens: number().int(),
25643
- stopSequences: array(string()).optional(),
25644
- /**
25645
- * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
25646
- */
25647
- metadata: AssertObjectSchema.optional(),
25648
- /**
25649
- * Tools that the model may use during generation.
25650
- * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
25651
- */
25652
- tools: array(ToolSchema).optional(),
25653
- /**
25654
- * Controls how the model uses tools.
25655
- * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
25656
- * Default is `{ mode: "auto" }`.
25657
- */
25658
- toolChoice: ToolChoiceSchema.optional()
25659
- });
25660
- /**
25661
- * 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.
25662
- */
25663
- const CreateMessageRequestSchema = RequestSchema.extend({
25664
- method: literal("sampling/createMessage"),
25665
- params: CreateMessageRequestParamsSchema
25666
- });
25667
- /**
25668
- * The client's response to a sampling/create_message request from the server.
25669
- * This is the backwards-compatible version that returns single content (no arrays).
25670
- * Used when the request does not include tools.
25671
- */
25672
- const CreateMessageResultSchema = ResultSchema.extend({
25673
- /**
25674
- * The name of the model that generated the message.
25675
- */
25676
- model: string(),
25677
- /**
25678
- * The reason why sampling stopped, if known.
25679
- *
25680
- * Standard values:
25681
- * - "endTurn": Natural end of the assistant's turn
25682
- * - "stopSequence": A stop sequence was encountered
25683
- * - "maxTokens": Maximum token limit was reached
25684
- *
25685
- * This field is an open string to allow for provider-specific stop reasons.
25686
- */
25687
- stopReason: optional(_enum([
25688
- "endTurn",
25689
- "stopSequence",
25690
- "maxTokens"
25691
- ]).or(string())),
25692
- role: RoleSchema,
25693
- /**
25694
- * Response content. Single content block (text, image, or audio).
25695
- */
25696
- content: SamplingContentSchema
25697
- });
25698
- /**
25699
- * The client's response to a sampling/create_message request when tools were provided.
25700
- * This version supports array content for tool use flows.
25701
- */
25702
- const CreateMessageResultWithToolsSchema = ResultSchema.extend({
25703
- /**
25704
- * The name of the model that generated the message.
25705
- */
25706
- model: string(),
25707
- /**
25708
- * The reason why sampling stopped, if known.
25709
- *
25710
- * Standard values:
25711
- * - "endTurn": Natural end of the assistant's turn
25712
- * - "stopSequence": A stop sequence was encountered
25713
- * - "maxTokens": Maximum token limit was reached
25714
- * - "toolUse": The model wants to use one or more tools
25715
- *
25716
- * This field is an open string to allow for provider-specific stop reasons.
25717
- */
25718
- stopReason: optional(_enum([
25719
- "endTurn",
25720
- "stopSequence",
25721
- "maxTokens",
25722
- "toolUse"
25723
- ]).or(string())),
25724
- role: RoleSchema,
25725
- /**
25726
- * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
25727
- */
25728
- content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)])
25729
- });
25730
- /**
25731
- * Primitive schema definition for boolean fields.
25732
- */
25733
- const BooleanSchemaSchema = object$1({
25734
- type: literal("boolean"),
25735
- title: string().optional(),
25736
- description: string().optional(),
25737
- default: boolean().optional()
25738
- });
25739
- /**
25740
- * Primitive schema definition for string fields.
25741
- */
25742
- const StringSchemaSchema = object$1({
25743
- type: literal("string"),
25744
- title: string().optional(),
25745
- description: string().optional(),
25746
- minLength: number().optional(),
25747
- maxLength: number().optional(),
25748
- format: _enum([
25749
- "email",
25750
- "uri",
25751
- "date",
25752
- "date-time"
25753
- ]).optional(),
25754
- default: string().optional()
25755
- });
25756
- /**
25757
- * Primitive schema definition for number fields.
25758
- */
25759
- const NumberSchemaSchema = object$1({
25760
- type: _enum(["number", "integer"]),
25761
- title: string().optional(),
25762
- description: string().optional(),
25763
- minimum: number().optional(),
25764
- maximum: number().optional(),
25765
- default: number().optional()
25766
- });
25767
- /**
25768
- * Schema for single-selection enumeration without display titles for options.
25769
- */
25770
- const UntitledSingleSelectEnumSchemaSchema = object$1({
25771
- type: literal("string"),
25772
- title: string().optional(),
25773
- description: string().optional(),
25774
- enum: array(string()),
25775
- default: string().optional()
25776
- });
25777
- /**
25778
- * Schema for single-selection enumeration with display titles for each option.
25779
- */
25780
- const TitledSingleSelectEnumSchemaSchema = object$1({
25781
- type: literal("string"),
25782
- title: string().optional(),
25783
- description: string().optional(),
25784
- oneOf: array(object$1({
25785
- const: string(),
25786
- title: string()
25787
- })),
25788
- default: string().optional()
25789
- });
25790
- /**
25791
- * Union of all primitive schema definitions.
25792
- */
25793
- const PrimitiveSchemaDefinitionSchema = union([
25794
- union([
25795
- object$1({
25796
- type: literal("string"),
25797
- title: string().optional(),
25798
- description: string().optional(),
25799
- enum: array(string()),
25800
- enumNames: array(string()).optional(),
25801
- default: string().optional()
25802
- }),
25803
- union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]),
25804
- union([object$1({
25805
- type: literal("array"),
25806
- title: string().optional(),
25807
- description: string().optional(),
25808
- minItems: number().optional(),
25809
- maxItems: number().optional(),
25810
- items: object$1({
25811
- type: literal("string"),
25812
- enum: array(string())
25813
- }),
25814
- default: array(string()).optional()
25815
- }), object$1({
25816
- type: literal("array"),
25817
- title: string().optional(),
25818
- description: string().optional(),
25819
- minItems: number().optional(),
25820
- maxItems: number().optional(),
25821
- items: object$1({ anyOf: array(object$1({
25822
- const: string(),
25823
- title: string()
25824
- })) }),
25825
- default: array(string()).optional()
25826
- })])
25827
- ]),
25828
- BooleanSchemaSchema,
25829
- StringSchemaSchema,
25830
- NumberSchemaSchema
25831
- ]);
25832
- /**
25833
- * The parameters for a request to elicit additional information from the user via the client.
25834
- */
25835
- const ElicitRequestParamsSchema = union([TaskAugmentedRequestParamsSchema.extend({
25836
- /**
25837
- * The elicitation mode.
25838
- *
25839
- * Optional for backward compatibility. Clients MUST treat missing mode as "form".
25840
- */
25841
- mode: literal("form").optional(),
25842
- /**
25843
- * The message to present to the user describing what information is being requested.
25844
- */
25845
- message: string(),
25846
- /**
25847
- * A restricted subset of JSON Schema.
25848
- * Only top-level properties are allowed, without nesting.
25849
- */
25850
- requestedSchema: object$1({
25851
- type: literal("object"),
25852
- properties: record(string(), PrimitiveSchemaDefinitionSchema),
25853
- required: array(string()).optional()
25854
- })
25855
- }), TaskAugmentedRequestParamsSchema.extend({
25856
- /**
25857
- * The elicitation mode.
25858
- */
25859
- mode: literal("url"),
25860
- /**
25861
- * The message to present to the user explaining why the interaction is needed.
25862
- */
25863
- message: string(),
25864
- /**
25865
- * The ID of the elicitation, which must be unique within the context of the server.
25866
- * The client MUST treat this ID as an opaque value.
25867
- */
25868
- elicitationId: string(),
25869
- /**
25870
- * The URL that the user should navigate to.
25871
- */
25872
- url: string().url()
25873
- })]);
25874
- /**
25875
- * A request from the server to elicit user input via the client.
25876
- * The client should present the message and form fields to the user (form mode)
25877
- * or navigate to a URL (URL mode).
25878
- */
25879
- const ElicitRequestSchema = RequestSchema.extend({
25880
- method: literal("elicitation/create"),
25881
- params: ElicitRequestParamsSchema
25882
- });
25883
- /**
25884
- * Parameters for a `notifications/elicitation/complete` notification.
25885
- *
25886
- * @category notifications/elicitation/complete
25887
- */
25888
- const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({
25889
- /**
25890
- * The ID of the elicitation that completed.
25891
- */
25892
- elicitationId: string() });
25893
- /**
25894
- * A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.
25895
- *
25896
- * @category notifications/elicitation/complete
25897
- */
25898
- const ElicitationCompleteNotificationSchema = NotificationSchema.extend({
25899
- method: literal("notifications/elicitation/complete"),
25900
- params: ElicitationCompleteNotificationParamsSchema
25901
- });
25902
- /**
25903
- * The client's response to an elicitation/create request from the server.
25904
- */
25905
- const ElicitResultSchema = ResultSchema.extend({
25906
- /**
25907
- * The user action in response to the elicitation.
25908
- * - "accept": User submitted the form/confirmed the action
25909
- * - "decline": User explicitly decline the action
25910
- * - "cancel": User dismissed without making an explicit choice
25911
- */
25912
- action: _enum([
25913
- "accept",
25914
- "decline",
25915
- "cancel"
25916
- ]),
25917
- /**
25918
- * The submitted form data, only present when action is "accept".
25919
- * Contains values matching the requested schema.
25920
- * Per MCP spec, content is "typically omitted" for decline/cancel actions.
25921
- * We normalize null to undefined for leniency while maintaining type compatibility.
25922
- */
25923
- content: preprocess((val) => val === null ? void 0 : val, record(string(), union([
25924
- string(),
25925
- number(),
25926
- boolean(),
25927
- array(string())
25928
- ])).optional())
25929
- });
25930
- /**
25931
- * A reference to a resource or resource template definition.
25932
- */
25933
- const ResourceTemplateReferenceSchema = object$1({
25934
- type: literal("ref/resource"),
25935
- /**
25936
- * The URI or URI template of the resource.
25937
- */
25938
- uri: string()
25939
- });
25940
- /**
25941
- * Identifies a prompt.
25942
- */
25943
- const PromptReferenceSchema = object$1({
25944
- type: literal("ref/prompt"),
25945
- /**
25946
- * The name of the prompt or prompt template
25947
- */
25948
- name: string()
25949
- });
25950
- /**
25951
- * Parameters for a `completion/complete` request.
25952
- */
25953
- const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
25954
- ref: union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
25955
- /**
25956
- * The argument's information
25957
- */
25958
- argument: object$1({
25959
- /**
25960
- * The name of the argument
25961
- */
25962
- name: string(),
25963
- /**
25964
- * The value of the argument to use for completion matching.
25965
- */
25966
- value: string()
25967
- }),
25968
- context: object$1({
25969
- /**
25970
- * Previously-resolved variables in a URI template or prompt.
25971
- */
25972
- arguments: record(string(), string()).optional() }).optional()
25973
- });
25974
- /**
25975
- * A request from the client to the server, to ask for completion options.
25976
- */
25977
- const CompleteRequestSchema = RequestSchema.extend({
25978
- method: literal("completion/complete"),
25979
- params: CompleteRequestParamsSchema
25980
- });
25981
- /**
25982
- * The server's response to a completion/complete request
25983
- */
25984
- const CompleteResultSchema = ResultSchema.extend({ completion: looseObject({
25985
- /**
25986
- * An array of completion values. Must not exceed 100 items.
25987
- */
25988
- values: array(string()).max(100),
25989
- /**
25990
- * The total number of completion options available. This can exceed the number of values actually sent in the response.
25991
- */
25992
- total: optional(number().int()),
25993
- /**
25994
- * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
25995
- */
25996
- hasMore: optional(boolean())
25997
- }) });
25998
- /**
25999
- * Represents a root directory or file that the server can operate on.
26000
- */
26001
- const RootSchema = object$1({
26002
- /**
26003
- * The URI identifying the root. This *must* start with file:// for now.
26004
- */
26005
- uri: string().startsWith("file://"),
26006
- /**
26007
- * An optional name for the root.
26008
- */
26009
- name: string().optional(),
26010
- /**
26011
- * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
26012
- * for notes on _meta usage.
26013
- */
26014
- _meta: record(string(), unknown()).optional()
26015
- });
26016
- /**
26017
- * Sent from the server to request a list of root URIs from the client.
26018
- */
26019
- const ListRootsRequestSchema = RequestSchema.extend({
26020
- method: literal("roots/list"),
26021
- params: BaseRequestParamsSchema.optional()
26022
- });
26023
- /**
26024
- * The client's response to a roots/list request from the server.
26025
- */
26026
- const ListRootsResultSchema = ResultSchema.extend({ roots: array(RootSchema) });
26027
- /**
26028
- * A notification from the client to the server, informing it that the list of roots has changed.
26029
- */
26030
- const RootsListChangedNotificationSchema = NotificationSchema.extend({
26031
- method: literal("notifications/roots/list_changed"),
26032
- params: NotificationsParamsSchema.optional()
26033
- });
26034
- union([
26035
- PingRequestSchema,
26036
- InitializeRequestSchema,
26037
- CompleteRequestSchema,
26038
- SetLevelRequestSchema,
26039
- GetPromptRequestSchema,
26040
- ListPromptsRequestSchema,
26041
- ListResourcesRequestSchema,
26042
- ListResourceTemplatesRequestSchema,
26043
- ReadResourceRequestSchema,
26044
- SubscribeRequestSchema,
26045
- UnsubscribeRequestSchema,
26046
- CallToolRequestSchema,
26047
- ListToolsRequestSchema,
26048
- GetTaskRequestSchema,
26049
- GetTaskPayloadRequestSchema,
26050
- ListTasksRequestSchema,
26051
- CancelTaskRequestSchema
26052
- ]);
26053
- union([
26054
- CancelledNotificationSchema,
26055
- ProgressNotificationSchema,
26056
- InitializedNotificationSchema,
26057
- RootsListChangedNotificationSchema,
26058
- TaskStatusNotificationSchema
26059
- ]);
26060
- union([
26061
- EmptyResultSchema,
26062
- CreateMessageResultSchema,
26063
- CreateMessageResultWithToolsSchema,
26064
- ElicitResultSchema,
26065
- ListRootsResultSchema,
26066
- GetTaskResultSchema,
26067
- ListTasksResultSchema,
26068
- CreateTaskResultSchema
26069
- ]);
26070
- union([
26071
- PingRequestSchema,
26072
- CreateMessageRequestSchema,
26073
- ElicitRequestSchema,
26074
- ListRootsRequestSchema,
26075
- GetTaskRequestSchema,
26076
- GetTaskPayloadRequestSchema,
26077
- ListTasksRequestSchema,
26078
- CancelTaskRequestSchema
26079
- ]);
26080
- union([
26081
- CancelledNotificationSchema,
26082
- ProgressNotificationSchema,
26083
- LoggingMessageNotificationSchema,
26084
- ResourceUpdatedNotificationSchema,
26085
- ResourceListChangedNotificationSchema,
26086
- ToolListChangedNotificationSchema,
26087
- PromptListChangedNotificationSchema,
26088
- TaskStatusNotificationSchema,
26089
- ElicitationCompleteNotificationSchema
26090
- ]);
26091
- union([
26092
- EmptyResultSchema,
26093
- InitializeResultSchema,
26094
- CompleteResultSchema,
26095
- GetPromptResultSchema,
26096
- ListPromptsResultSchema,
26097
- ListResourcesResultSchema,
26098
- ListResourceTemplatesResultSchema,
26099
- ReadResourceResultSchema,
26100
- CallToolResultSchema,
26101
- ListToolsResultSchema,
26102
- GetTaskResultSchema,
26103
- ListTasksResultSchema,
26104
- CreateTaskResultSchema
26105
- ]);
26106
- //#endregion
26107
24187
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono-mcp-server-sse-transport/0.0.7/d5ae5a23aa2b79db7055621f11a7cbc8d27f7caba1eeb308ab2cf5bcb1a8e5b8/node_modules/hono-mcp-server-sse-transport/build/sse.js
26108
24188
  const MAXIMUM_MESSAGE_SIZE = 4 * 1024 * 1024;
26109
24189
  var SSETransport = class {