ai 5.0.0-canary.15 → 5.0.0-canary.16

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
@@ -77,13 +77,12 @@ __export(ai_exports, {
77
77
  experimental_transcribe: () => transcribe,
78
78
  extractMaxToolInvocationStep: () => extractMaxToolInvocationStep,
79
79
  extractReasoningMiddleware: () => extractReasoningMiddleware,
80
- fillMessageParts: () => fillMessageParts,
81
80
  formatDataStreamPart: () => formatDataStreamPart,
82
81
  generateId: () => import_provider_utils21.generateId,
83
82
  generateObject: () => generateObject,
84
83
  generateText: () => generateText,
85
- getMessageParts: () => getMessageParts,
86
84
  getTextFromDataUrl: () => getTextFromDataUrl,
85
+ getToolInvocations: () => getToolInvocations,
87
86
  isAssistantMessageWithCompletedToolCalls: () => isAssistantMessageWithCompletedToolCalls,
88
87
  isDeepEqualData: () => isDeepEqualData,
89
88
  jsonSchema: () => import_provider_utils4.jsonSchema,
@@ -126,6 +125,21 @@ function calculateLanguageModelUsage({
126
125
  };
127
126
  }
128
127
 
128
+ // core/ui/get-tool-invocations.ts
129
+ function getToolInvocations(message) {
130
+ return message.parts.filter(
131
+ (part) => part.type === "tool-invocation"
132
+ ).map((part) => part.toolInvocation);
133
+ }
134
+
135
+ // core/util/extract-max-tool-invocation-step.ts
136
+ function extractMaxToolInvocationStep(toolInvocations) {
137
+ return toolInvocations == null ? void 0 : toolInvocations.reduce((max, toolInvocation) => {
138
+ var _a17;
139
+ return Math.max(max, (_a17 = toolInvocation.step) != null ? _a17 : 0);
140
+ }, 0);
141
+ }
142
+
129
143
  // core/util/parse-partial-json.ts
130
144
  var import_provider_utils = require("@ai-sdk/provider-utils");
131
145
 
@@ -848,13 +862,9 @@ async function processChatResponse({
848
862
  getCurrentDate = () => /* @__PURE__ */ new Date(),
849
863
  lastMessage
850
864
  }) {
851
- var _a17, _b;
865
+ var _a17;
852
866
  const replaceLastMessage = (lastMessage == null ? void 0 : lastMessage.role) === "assistant";
853
- let step = replaceLastMessage ? 1 + // find max step in existing tool invocations:
854
- ((_b = (_a17 = lastMessage.toolInvocations) == null ? void 0 : _a17.reduce((max, toolInvocation) => {
855
- var _a18;
856
- return Math.max(max, (_a18 = toolInvocation.step) != null ? _a18 : 0);
857
- }, 0)) != null ? _b : 0) : 0;
867
+ let step = replaceLastMessage ? 1 + ((_a17 = extractMaxToolInvocationStep(getToolInvocations(lastMessage))) != null ? _a17 : 0) : 0;
858
868
  const message = replaceLastMessage ? structuredClone(lastMessage) : {
859
869
  id: generateId3(),
860
870
  createdAt: getCurrentDate(),
@@ -927,12 +937,12 @@ async function processChatResponse({
927
937
  if (currentReasoningPart == null) {
928
938
  currentReasoningPart = {
929
939
  type: "reasoning",
930
- reasoning: value.text,
940
+ text: value.text,
931
941
  providerMetadata: value.providerMetadata
932
942
  };
933
943
  message.parts.push(currentReasoningPart);
934
944
  } else {
935
- currentReasoningPart.reasoning += value.text;
945
+ currentReasoningPart.text += value.text;
936
946
  currentReasoningPart.providerMetadata = value.providerMetadata;
937
947
  }
938
948
  execUpdate();
@@ -958,24 +968,20 @@ async function processChatResponse({
958
968
  execUpdate();
959
969
  },
960
970
  onToolCallStreamingStartPart(value) {
961
- if (message.toolInvocations == null) {
962
- message.toolInvocations = [];
963
- }
971
+ const toolInvocations = getToolInvocations(message);
964
972
  partialToolCalls[value.toolCallId] = {
965
973
  text: "",
966
974
  step,
967
975
  toolName: value.toolName,
968
- index: message.toolInvocations.length
976
+ index: toolInvocations.length
969
977
  };
970
- const invocation = {
978
+ updateToolInvocationPart(value.toolCallId, {
971
979
  state: "partial-call",
972
980
  step,
973
981
  toolCallId: value.toolCallId,
974
982
  toolName: value.toolName,
975
983
  args: void 0
976
- };
977
- message.toolInvocations.push(invocation);
978
- updateToolInvocationPart(value.toolCallId, invocation);
984
+ });
979
985
  execUpdate();
980
986
  },
981
987
  async onToolCallDeltaPart(value) {
@@ -984,68 +990,53 @@ async function processChatResponse({
984
990
  const { value: partialArgs } = await parsePartialJson(
985
991
  partialToolCall.text
986
992
  );
987
- const invocation = {
993
+ updateToolInvocationPart(value.toolCallId, {
988
994
  state: "partial-call",
989
995
  step: partialToolCall.step,
990
996
  toolCallId: value.toolCallId,
991
997
  toolName: partialToolCall.toolName,
992
998
  args: partialArgs
993
- };
994
- message.toolInvocations[partialToolCall.index] = invocation;
995
- updateToolInvocationPart(value.toolCallId, invocation);
999
+ });
996
1000
  execUpdate();
997
1001
  },
998
1002
  async onToolCallPart(value) {
999
- const invocation = {
1003
+ updateToolInvocationPart(value.toolCallId, {
1000
1004
  state: "call",
1001
1005
  step,
1002
1006
  ...value
1003
- };
1004
- if (partialToolCalls[value.toolCallId] != null) {
1005
- message.toolInvocations[partialToolCalls[value.toolCallId].index] = invocation;
1006
- } else {
1007
- if (message.toolInvocations == null) {
1008
- message.toolInvocations = [];
1009
- }
1010
- message.toolInvocations.push(invocation);
1011
- }
1012
- updateToolInvocationPart(value.toolCallId, invocation);
1007
+ });
1013
1008
  execUpdate();
1014
1009
  if (onToolCall) {
1015
1010
  const result = await onToolCall({ toolCall: value });
1016
1011
  if (result != null) {
1017
- const invocation2 = {
1012
+ updateToolInvocationPart(value.toolCallId, {
1018
1013
  state: "result",
1019
1014
  step,
1020
1015
  ...value,
1021
1016
  result
1022
- };
1023
- message.toolInvocations[message.toolInvocations.length - 1] = invocation2;
1024
- updateToolInvocationPart(value.toolCallId, invocation2);
1017
+ });
1025
1018
  execUpdate();
1026
1019
  }
1027
1020
  }
1028
1021
  },
1029
1022
  onToolResultPart(value) {
1030
- const toolInvocations = message.toolInvocations;
1023
+ const toolInvocations = getToolInvocations(message);
1031
1024
  if (toolInvocations == null) {
1032
1025
  throw new Error("tool_result must be preceded by a tool_call");
1033
1026
  }
1034
1027
  const toolInvocationIndex = toolInvocations.findIndex(
1035
- (invocation2) => invocation2.toolCallId === value.toolCallId
1028
+ (invocation) => invocation.toolCallId === value.toolCallId
1036
1029
  );
1037
1030
  if (toolInvocationIndex === -1) {
1038
1031
  throw new Error(
1039
1032
  "tool_result must be preceded by a tool_call with the same toolCallId"
1040
1033
  );
1041
1034
  }
1042
- const invocation = {
1035
+ updateToolInvocationPart(value.toolCallId, {
1043
1036
  ...toolInvocations[toolInvocationIndex],
1044
1037
  state: "result",
1045
1038
  ...value
1046
- };
1047
- toolInvocations[toolInvocationIndex] = invocation;
1048
- updateToolInvocationPart(value.toolCallId, invocation);
1039
+ });
1049
1040
  execUpdate();
1050
1041
  },
1051
1042
  onDataPart(value) {
@@ -1341,34 +1332,6 @@ function getTextFromDataUrl(dataUrl) {
1341
1332
  }
1342
1333
  }
1343
1334
 
1344
- // core/util/extract-max-tool-invocation-step.ts
1345
- function extractMaxToolInvocationStep(toolInvocations) {
1346
- return toolInvocations == null ? void 0 : toolInvocations.reduce((max, toolInvocation) => {
1347
- var _a17;
1348
- return Math.max(max, (_a17 = toolInvocation.step) != null ? _a17 : 0);
1349
- }, 0);
1350
- }
1351
-
1352
- // core/util/get-message-parts.ts
1353
- function getMessageParts(message) {
1354
- var _a17;
1355
- return (_a17 = message.parts) != null ? _a17 : [
1356
- ...message.toolInvocations ? message.toolInvocations.map((toolInvocation) => ({
1357
- type: "tool-invocation",
1358
- toolInvocation
1359
- })) : [],
1360
- ...message.content ? [{ type: "text", text: message.content }] : []
1361
- ];
1362
- }
1363
-
1364
- // core/util/fill-message-parts.ts
1365
- function fillMessageParts(messages) {
1366
- return messages.map((message) => ({
1367
- ...message,
1368
- parts: getMessageParts(message)
1369
- }));
1370
- }
1371
-
1372
1335
  // core/util/is-deep-equal-data.ts
1373
1336
  function isDeepEqualData(obj1, obj2) {
1374
1337
  if (obj1 === obj2)
@@ -1409,7 +1372,7 @@ async function prepareAttachmentsForRequest(attachmentsFromOptions) {
1409
1372
  if (!attachmentsFromOptions) {
1410
1373
  return [];
1411
1374
  }
1412
- if (attachmentsFromOptions instanceof FileList) {
1375
+ if (globalThis.FileList && attachmentsFromOptions instanceof globalThis.FileList) {
1413
1376
  return Promise.all(
1414
1377
  Array.from(attachmentsFromOptions).map(async (attachment) => {
1415
1378
  const { name: name17, type } = attachment;
@@ -1442,7 +1405,6 @@ function updateToolCallResult({
1442
1405
  toolCallId,
1443
1406
  toolResult: result
1444
1407
  }) {
1445
- var _a17;
1446
1408
  const lastMessage = messages[messages.length - 1];
1447
1409
  const invocationPart = lastMessage.parts.find(
1448
1410
  (part) => part.type === "tool-invocation" && part.toolInvocation.toolCallId === toolCallId
@@ -1450,15 +1412,11 @@ function updateToolCallResult({
1450
1412
  if (invocationPart == null) {
1451
1413
  return;
1452
1414
  }
1453
- const toolResult = {
1415
+ invocationPart.toolInvocation = {
1454
1416
  ...invocationPart.toolInvocation,
1455
1417
  state: "result",
1456
1418
  result
1457
1419
  };
1458
- invocationPart.toolInvocation = toolResult;
1459
- lastMessage.toolInvocations = (_a17 = lastMessage.toolInvocations) == null ? void 0 : _a17.map(
1460
- (toolInvocation) => toolInvocation.toolCallId === toolCallId ? toolResult : toolInvocation
1461
- );
1462
1420
  }
1463
1421
 
1464
1422
  // core/util/should-resubmit-messages.ts
@@ -1474,9 +1432,9 @@ function shouldResubmitMessages({
1474
1432
  // check if the feature is enabled:
1475
1433
  maxSteps > 1 && // ensure there is a last message:
1476
1434
  lastMessage != null && // ensure we actually have new steps (to prevent infinite loops in case of errors):
1477
- (messages.length > originalMessageCount || extractMaxToolInvocationStep(lastMessage.toolInvocations) !== originalMaxToolInvocationStep) && // check that next step is possible:
1435
+ (messages.length > originalMessageCount || extractMaxToolInvocationStep(getToolInvocations(lastMessage)) !== originalMaxToolInvocationStep) && // check that next step is possible:
1478
1436
  isAssistantMessageWithCompletedToolCalls(lastMessage) && // limit the number of automatic steps:
1479
- ((_a17 = extractMaxToolInvocationStep(lastMessage.toolInvocations)) != null ? _a17 : 0) < maxSteps
1437
+ ((_a17 = extractMaxToolInvocationStep(getToolInvocations(lastMessage))) != null ? _a17 : 0) < maxSteps
1480
1438
  );
1481
1439
  }
1482
1440
  function isAssistantMessageWithCompletedToolCalls(message) {
@@ -3278,7 +3236,7 @@ function convertToCoreMessages(messages, options) {
3278
3236
  case "reasoning": {
3279
3237
  content2.push({
3280
3238
  type: "reasoning",
3281
- text: part.reasoning,
3239
+ text: part.text,
3282
3240
  providerOptions: part.providerMetadata
3283
3241
  });
3284
3242
  break;
@@ -3368,73 +3326,11 @@ function convertToCoreMessages(messages, options) {
3368
3326
  processBlock2();
3369
3327
  break;
3370
3328
  }
3371
- const toolInvocations = message.toolInvocations;
3372
- if (toolInvocations == null || toolInvocations.length === 0) {
3373
- coreMessages.push({ role: "assistant", content });
3374
- break;
3375
- }
3376
- const maxStep = toolInvocations.reduce((max, toolInvocation) => {
3377
- var _a18;
3378
- return Math.max(max, (_a18 = toolInvocation.step) != null ? _a18 : 0);
3379
- }, 0);
3380
- for (let i2 = 0; i2 <= maxStep; i2++) {
3381
- const stepInvocations = toolInvocations.filter(
3382
- (toolInvocation) => {
3383
- var _a18;
3384
- return ((_a18 = toolInvocation.step) != null ? _a18 : 0) === i2;
3385
- }
3386
- );
3387
- if (stepInvocations.length === 0) {
3388
- continue;
3389
- }
3390
- coreMessages.push({
3391
- role: "assistant",
3392
- content: [
3393
- ...isLastMessage && content && i2 === 0 ? [{ type: "text", text: content }] : [],
3394
- ...stepInvocations.map(
3395
- ({ toolCallId, toolName, args }) => ({
3396
- type: "tool-call",
3397
- toolCallId,
3398
- toolName,
3399
- args
3400
- })
3401
- )
3402
- ]
3403
- });
3404
- coreMessages.push({
3405
- role: "tool",
3406
- content: stepInvocations.map((toolInvocation) => {
3407
- if (!("result" in toolInvocation)) {
3408
- throw new MessageConversionError({
3409
- originalMessage: message,
3410
- message: "ToolInvocation must have a result: " + JSON.stringify(toolInvocation)
3411
- });
3412
- }
3413
- const { toolCallId, toolName, result } = toolInvocation;
3414
- const tool2 = tools[toolName];
3415
- return (tool2 == null ? void 0 : tool2.experimental_toToolResultContent) != null ? {
3416
- type: "tool-result",
3417
- toolCallId,
3418
- toolName,
3419
- result: tool2.experimental_toToolResultContent(result),
3420
- experimental_content: tool2.experimental_toToolResultContent(result)
3421
- } : {
3422
- type: "tool-result",
3423
- toolCallId,
3424
- toolName,
3425
- result
3426
- };
3427
- })
3428
- });
3429
- }
3430
3329
  if (content && !isLastMessage) {
3431
3330
  coreMessages.push({ role: "assistant", content });
3432
3331
  }
3433
3332
  break;
3434
3333
  }
3435
- case "data": {
3436
- break;
3437
- }
3438
3334
  default: {
3439
3335
  const _exhaustiveCheck = role;
3440
3336
  throw new MessageConversionError({
@@ -3919,10 +3815,36 @@ var enumOutputStrategy = (enumValues) => {
3919
3815
  })
3920
3816
  };
3921
3817
  },
3922
- validatePartialResult() {
3923
- throw new import_provider12.UnsupportedFunctionalityError({
3924
- functionality: "partial results in enum mode"
3925
- });
3818
+ async validatePartialResult({ value, textDelta }) {
3819
+ if (!(0, import_provider12.isJSONObject)(value) || typeof value.result !== "string") {
3820
+ return {
3821
+ success: false,
3822
+ error: new import_provider12.TypeValidationError({
3823
+ value,
3824
+ cause: 'value must be an object that contains a string in the "result" property.'
3825
+ })
3826
+ };
3827
+ }
3828
+ const result = value.result;
3829
+ const possibleEnumValues = enumValues.filter(
3830
+ (enumValue) => enumValue.startsWith(result)
3831
+ );
3832
+ if (value.result.length === 0 || possibleEnumValues.length === 0) {
3833
+ return {
3834
+ success: false,
3835
+ error: new import_provider12.TypeValidationError({
3836
+ value,
3837
+ cause: "value must be a string in the enum"
3838
+ })
3839
+ };
3840
+ }
3841
+ return {
3842
+ success: true,
3843
+ value: {
3844
+ partial: possibleEnumValues.length > 1 ? result : possibleEnumValues[0],
3845
+ textDelta
3846
+ }
3847
+ };
3926
3848
  },
3927
3849
  createElementStream() {
3928
3850
  throw new import_provider12.UnsupportedFunctionalityError({
@@ -4508,6 +4430,7 @@ function streamObject(options) {
4508
4430
  } = {},
4509
4431
  ...settings
4510
4432
  } = options;
4433
+ const enumValues = "enum" in options && options.enum ? options.enum : void 0;
4511
4434
  const {
4512
4435
  schema: inputSchema,
4513
4436
  schemaDescription,
@@ -4517,9 +4440,14 @@ function streamObject(options) {
4517
4440
  output,
4518
4441
  schema: inputSchema,
4519
4442
  schemaName,
4520
- schemaDescription
4443
+ schemaDescription,
4444
+ enumValues
4445
+ });
4446
+ const outputStrategy = getOutputStrategy({
4447
+ output,
4448
+ schema: inputSchema,
4449
+ enumValues
4521
4450
  });
4522
- const outputStrategy = getOutputStrategy({ output, schema: inputSchema });
4523
4451
  return new DefaultStreamObjectResult({
4524
4452
  model,
4525
4453
  telemetry,
@@ -7935,7 +7863,7 @@ function appendResponseMessages({
7935
7863
  responseMessages,
7936
7864
  _internal: { currentDate = () => /* @__PURE__ */ new Date() } = {}
7937
7865
  }) {
7938
- var _a17, _b, _c, _d, _e;
7866
+ var _a17, _b, _c;
7939
7867
  const clonedMessages = structuredClone(messages);
7940
7868
  for (const message of responseMessages) {
7941
7869
  const role = message.role;
@@ -7943,7 +7871,7 @@ function appendResponseMessages({
7943
7871
  const isLastMessageAssistant = lastMessage.role === "assistant";
7944
7872
  switch (role) {
7945
7873
  case "assistant": {
7946
- let getToolInvocations2 = function(step) {
7874
+ let getToolInvocationsForStep2 = function(step) {
7947
7875
  return (typeof message.content === "string" ? [] : message.content.filter((part) => part.type === "tool-call")).map((call) => ({
7948
7876
  state: "call",
7949
7877
  step,
@@ -7952,7 +7880,7 @@ function appendResponseMessages({
7952
7880
  toolName: call.toolName
7953
7881
  }));
7954
7882
  };
7955
- var getToolInvocations = getToolInvocations2;
7883
+ var getToolInvocationsForStep = getToolInvocationsForStep2;
7956
7884
  const parts = [{ type: "step-start" }];
7957
7885
  let textContent = "";
7958
7886
  let reasoningTextContent = void 0;
@@ -7979,12 +7907,12 @@ function appendResponseMessages({
7979
7907
  if (reasoningPart == null) {
7980
7908
  reasoningPart = {
7981
7909
  type: "reasoning",
7982
- reasoning: ""
7910
+ text: ""
7983
7911
  };
7984
7912
  parts.push(reasoningPart);
7985
7913
  }
7986
7914
  reasoningTextContent = (reasoningTextContent != null ? reasoningTextContent : "") + part.text;
7987
- reasoningPart.reasoning += part.text;
7915
+ reasoningPart.text += part.text;
7988
7916
  reasoningPart.providerMetadata = part.providerOptions;
7989
7917
  break;
7990
7918
  }
@@ -8008,16 +7936,13 @@ function appendResponseMessages({
8008
7936
  }
8009
7937
  if (isLastMessageAssistant) {
8010
7938
  const maxStep = extractMaxToolInvocationStep(
8011
- lastMessage.toolInvocations
7939
+ getToolInvocations(lastMessage)
7940
+ // TODO remove once Message is removed
8012
7941
  );
8013
7942
  (_b = lastMessage.parts) != null ? _b : lastMessage.parts = [];
8014
7943
  lastMessage.content = textContent;
8015
7944
  lastMessage.parts.push(...parts);
8016
- lastMessage.toolInvocations = [
8017
- ...(_c = lastMessage.toolInvocations) != null ? _c : [],
8018
- ...getToolInvocations2(maxStep === void 0 ? 0 : maxStep + 1)
8019
- ];
8020
- getToolInvocations2(maxStep === void 0 ? 0 : maxStep + 1).map((call) => ({
7945
+ getToolInvocationsForStep2(maxStep === void 0 ? 0 : maxStep + 1).map((call) => ({
8021
7946
  type: "tool-invocation",
8022
7947
  toolInvocation: call
8023
7948
  })).forEach((part) => {
@@ -8030,10 +7955,9 @@ function appendResponseMessages({
8030
7955
  createdAt: currentDate(),
8031
7956
  // generate a createdAt date for the message, will be overridden by the client
8032
7957
  content: textContent,
8033
- toolInvocations: getToolInvocations2(0),
8034
7958
  parts: [
8035
7959
  ...parts,
8036
- ...getToolInvocations2(0).map((call) => ({
7960
+ ...getToolInvocationsForStep2(0).map((call) => ({
8037
7961
  type: "tool-invocation",
8038
7962
  toolInvocation: call
8039
7963
  }))
@@ -8043,17 +7967,17 @@ function appendResponseMessages({
8043
7967
  break;
8044
7968
  }
8045
7969
  case "tool": {
8046
- (_d = lastMessage.toolInvocations) != null ? _d : lastMessage.toolInvocations = [];
8047
7970
  if (lastMessage.role !== "assistant") {
8048
7971
  throw new Error(
8049
7972
  `Tool result must follow an assistant message: ${lastMessage.role}`
8050
7973
  );
8051
7974
  }
8052
- (_e = lastMessage.parts) != null ? _e : lastMessage.parts = [];
7975
+ (_c = lastMessage.parts) != null ? _c : lastMessage.parts = [];
8053
7976
  for (const contentPart of message.content) {
8054
- const toolCall = lastMessage.toolInvocations.find(
8055
- (call) => call.toolCallId === contentPart.toolCallId
8056
- );
7977
+ const toolCall = getToolInvocations(
7978
+ lastMessage
7979
+ // TODO remove once Message is removed
7980
+ ).find((call) => call.toolCallId === contentPart.toolCallId);
8057
7981
  const toolCallPart = lastMessage.parts.find(
8058
7982
  (part) => part.type === "tool-invocation" && part.toolInvocation.toolCallId === contentPart.toolCallId
8059
7983
  );
@@ -8606,6 +8530,24 @@ var MCPClient = class {
8606
8530
  await ((_a17 = this.transport) == null ? void 0 : _a17.close());
8607
8531
  this.onClose();
8608
8532
  }
8533
+ assertCapability(method) {
8534
+ switch (method) {
8535
+ case "initialize":
8536
+ break;
8537
+ case "tools/list":
8538
+ case "tools/call":
8539
+ if (!this.serverCapabilities.tools) {
8540
+ throw new MCPClientError({
8541
+ message: `Server does not support tools`
8542
+ });
8543
+ }
8544
+ break;
8545
+ default:
8546
+ throw new MCPClientError({
8547
+ message: `Unsupported method: ${method}`
8548
+ });
8549
+ }
8550
+ }
8609
8551
  async request({
8610
8552
  request,
8611
8553
  resultSchema,
@@ -8619,6 +8561,7 @@ var MCPClient = class {
8619
8561
  })
8620
8562
  );
8621
8563
  }
8564
+ this.assertCapability(request.method);
8622
8565
  const signal = options == null ? void 0 : options.signal;
8623
8566
  signal == null ? void 0 : signal.throwIfAborted();
8624
8567
  const messageId = this.requestMessageId++;
@@ -8647,7 +8590,7 @@ var MCPClient = class {
8647
8590
  resolve(result);
8648
8591
  } catch (error) {
8649
8592
  const parseError = new MCPClientError({
8650
- message: "Failed to parse server initialization result",
8593
+ message: "Failed to parse server response",
8651
8594
  cause: error
8652
8595
  });
8653
8596
  reject(parseError);
@@ -8663,11 +8606,6 @@ var MCPClient = class {
8663
8606
  params,
8664
8607
  options
8665
8608
  } = {}) {
8666
- if (!this.serverCapabilities.tools) {
8667
- throw new MCPClientError({
8668
- message: `Server does not support tools`
8669
- });
8670
- }
8671
8609
  try {
8672
8610
  return this.request({
8673
8611
  request: { method: "tools/list", params },
@@ -8683,11 +8621,6 @@ var MCPClient = class {
8683
8621
  args,
8684
8622
  options
8685
8623
  }) {
8686
- if (!this.serverCapabilities.tools) {
8687
- throw new MCPClientError({
8688
- message: `Server does not support tools`
8689
- });
8690
- }
8691
8624
  try {
8692
8625
  return this.request({
8693
8626
  request: { method: "tools/call", params: { name: name17, arguments: args } },
@@ -8958,13 +8891,12 @@ var StreamData = class {
8958
8891
  experimental_transcribe,
8959
8892
  extractMaxToolInvocationStep,
8960
8893
  extractReasoningMiddleware,
8961
- fillMessageParts,
8962
8894
  formatDataStreamPart,
8963
8895
  generateId,
8964
8896
  generateObject,
8965
8897
  generateText,
8966
- getMessageParts,
8967
8898
  getTextFromDataUrl,
8899
+ getToolInvocations,
8968
8900
  isAssistantMessageWithCompletedToolCalls,
8969
8901
  isDeepEqualData,
8970
8902
  jsonSchema,