@ai-sdk/mcp 1.0.34 → 1.0.36

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
@@ -54,7 +54,8 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
54
54
  var ToolMetaSchema = z.optional(z.record(z.string(), z.unknown()));
55
55
  var ClientOrServerImplementationSchema = z.looseObject({
56
56
  name: z.string(),
57
- version: z.string()
57
+ version: z.string(),
58
+ title: z.optional(z.string())
58
59
  });
59
60
  var BaseParamsSchema = z.looseObject({
60
61
  _meta: z.optional(z.object({}).loose())
@@ -1641,6 +1642,7 @@ var DefaultMCPClient = class {
1641
1642
  this.requestMessageId = 0;
1642
1643
  this.responseHandlers = /* @__PURE__ */ new Map();
1643
1644
  this.serverCapabilities = {};
1645
+ this._serverInfo = { name: "", version: "" };
1644
1646
  this.isClosed = true;
1645
1647
  this.onUncaughtError = onUncaughtError;
1646
1648
  this.clientCapabilities = capabilities != null ? capabilities : {};
@@ -1671,6 +1673,9 @@ var DefaultMCPClient = class {
1671
1673
  version
1672
1674
  };
1673
1675
  }
1676
+ get serverInfo() {
1677
+ return this._serverInfo;
1678
+ }
1674
1679
  async init() {
1675
1680
  try {
1676
1681
  await this.transport.start();
@@ -1697,6 +1702,7 @@ var DefaultMCPClient = class {
1697
1702
  });
1698
1703
  }
1699
1704
  this.serverCapabilities = result.capabilities;
1705
+ this._serverInfo = result.serverInfo;
1700
1706
  await this.notification({
1701
1707
  method: "notifications/initialized"
1702
1708
  });
@@ -1942,6 +1948,9 @@ var DefaultMCPClient = class {
1942
1948
  var _a4;
1943
1949
  (_a4 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a4.throwIfAborted();
1944
1950
  const result = await self.callTool({ name: name3, args, options });
1951
+ if (result.isError) {
1952
+ return result;
1953
+ }
1945
1954
  if (outputSchema != null) {
1946
1955
  return self.extractStructuredContent(result, outputSchema, name3);
1947
1956
  }