@ai-sdk/mcp 1.0.50 → 1.0.52

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.mjs CHANGED
@@ -1266,6 +1266,9 @@ async function authInternal(provider, {
1266
1266
  }
1267
1267
 
1268
1268
  // src/tool/mcp-sse-transport.ts
1269
+ function isMessageEvent(event) {
1270
+ return event === void 0 || event === "message";
1271
+ }
1269
1272
  var SseMCPTransport = class {
1270
1273
  constructor({
1271
1274
  url,
@@ -1384,7 +1387,7 @@ var SseMCPTransport = class {
1384
1387
  this.endpoint = endpoint;
1385
1388
  this.connected = true;
1386
1389
  resolve();
1387
- } else if (event === "message") {
1390
+ } else if (isMessageEvent(event)) {
1388
1391
  try {
1389
1392
  const message = await parseJSONRPCMessage(data);
1390
1393
  (_c2 = this.onmessage) == null ? void 0 : _c2.call(this, message);
@@ -1491,6 +1494,9 @@ import {
1491
1494
  withUserAgentSuffix as withUserAgentSuffix2,
1492
1495
  getRuntimeEnvironmentUserAgent as getRuntimeEnvironmentUserAgent2
1493
1496
  } from "@ai-sdk/provider-utils";
1497
+ function isMessageEvent2(event) {
1498
+ return event === void 0 || event === "message";
1499
+ }
1494
1500
  var HttpMCPTransport = class {
1495
1501
  constructor({
1496
1502
  url,
@@ -1667,7 +1673,7 @@ var HttpMCPTransport = class {
1667
1673
  const { done, value } = await reader.read();
1668
1674
  if (done) return;
1669
1675
  const { event, data } = value;
1670
- if (event === "message") {
1676
+ if (isMessageEvent2(event)) {
1671
1677
  try {
1672
1678
  const msg = await parseJSONRPCMessage(data);
1673
1679
  (_a4 = this.onmessage) == null ? void 0 : _a4.call(this, msg);
@@ -1794,7 +1800,7 @@ var HttpMCPTransport = class {
1794
1800
  if (id) {
1795
1801
  this.lastInboundEventId = id;
1796
1802
  }
1797
- if (event === "message") {
1803
+ if (isMessageEvent2(event)) {
1798
1804
  try {
1799
1805
  const msg = await parseJSONRPCMessage(data);
1800
1806
  (_a4 = this.onmessage) == null ? void 0 : _a4.call(this, msg);