@composio/core 0.1.31 → 0.1.33

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.cjs CHANGED
@@ -48,12 +48,19 @@ __export(index_exports, {
48
48
  Composio: () => Composio,
49
49
  ComposioAuthConfigNotFoundError: () => ComposioAuthConfigNotFoundError,
50
50
  ComposioConnectedAccountNotFoundError: () => ComposioConnectedAccountNotFoundError,
51
+ ComposioCustomCreateResponseSchema: () => ComposioCustomCreateResponseSchema,
51
52
  ComposioCustomToolsNotInitializedError: () => ComposioCustomToolsNotInitializedError,
52
53
  ComposioError: () => ComposioError,
54
+ ComposioGenerateURLParamsSchema: () => ComposioGenerateURLParamsSchema,
55
+ ComposioGenerateURLResponseSchema: () => ComposioGenerateURLResponseSchema,
53
56
  ComposioGlobalExecuteToolFnNotSetError: () => ComposioGlobalExecuteToolFnNotSetError,
54
57
  ComposioInvalidExecuteFunctionError: () => ComposioInvalidExecuteFunctionError,
55
58
  ComposioInvalidModifierError: () => ComposioInvalidModifierError,
56
59
  ComposioLinkConnectionDataSchema: () => ComposioLinkConnectionDataSchema,
60
+ ComposioMcpDeleteResponseSchema: () => ComposioMcpDeleteResponseSchema,
61
+ ComposioMcpListResponseSchema: () => ComposioMcpListResponseSchema,
62
+ ComposioMcpRetrieveResponseSchema: () => ComposioMcpRetrieveResponseSchema,
63
+ ComposioMcpUpdateResponseSchema: () => ComposioMcpUpdateResponseSchema,
57
64
  ComposioMultipleConnectedAccountsError: () => ComposioMultipleConnectedAccountsError,
58
65
  ComposioNoAPIKeyError: () => ComposioNoAPIKeyError,
59
66
  ComposioProvider: () => ComposioProvider,
@@ -62,7 +69,13 @@ __export(index_exports, {
62
69
  ComposioToolNotFoundError: () => ComposioToolNotFoundError,
63
70
  ComposioToolkitFetchError: () => ComposioToolkitFetchError,
64
71
  ComposioToolkitNotFoundError: () => ComposioToolkitNotFoundError,
72
+ ConnectedAccountAuthConfigSchema: () => ConnectedAccountAuthConfigSchema,
65
73
  ConnectedAccountErrorCodes: () => ConnectedAccountErrorCodes,
74
+ ConnectedAccountListParamsSchema: () => ConnectedAccountListParamsSchema,
75
+ ConnectedAccountListResponseSchema: () => ConnectedAccountListResponseSchema,
76
+ ConnectedAccountRetrieveResponseSchema: () => ConnectedAccountRetrieveResponseSchema,
77
+ ConnectedAccountStatusSchema: () => ConnectedAccountStatusSchema,
78
+ ConnectedAccountStatuses: () => ConnectedAccountStatuses,
66
79
  ConnectionDataSchema: () => ConnectionDataSchema,
67
80
  ConnectionRequestErrorCodes: () => ConnectionRequestErrorCodes,
68
81
  ConnectionRequestFailedError: () => ConnectionRequestFailedError,
@@ -71,13 +84,14 @@ __export(index_exports, {
71
84
  CreateAuthConfigParamsSchema: () => CreateAuthConfigParamsSchema,
72
85
  CreateAuthConfigResponseSchema: () => CreateAuthConfigResponseSchema,
73
86
  CreateComposioManagedAuthConfigParamsSchema: () => CreateComposioManagedAuthConfigParamsSchema,
87
+ CreateConnectedAccountOptionsSchema: () => CreateConnectedAccountOptionsSchema,
88
+ CreateConnectedAccountParamsSchema: () => CreateConnectedAccountParamsSchema,
89
+ CreateConnectedAccountResponseSchema: () => CreateConnectedAccountResponseSchema,
74
90
  CreateCustomAuthConfigParamsSchema: () => CreateCustomAuthConfigParamsSchema,
75
91
  CustomAuthParamsSchema: () => CustomAuthParamsSchema,
76
- CustomCreateResponseCamelCaseSchema: () => CustomCreateResponseCamelCaseSchema,
77
92
  CustomCreateResponseSchema: () => CustomCreateResponseSchema,
93
+ DefaultCreateConnectedAccountParamsSchema: () => DefaultCreateConnectedAccountParamsSchema,
78
94
  GenerateURLParamsSchema: () => GenerateURLParamsSchema,
79
- GenerateURLParamsSnakeCaseSchema: () => GenerateURLParamsSnakeCaseSchema,
80
- GenerateURLResponseCamelCaseSchema: () => GenerateURLResponseCamelCaseSchema,
81
95
  GenerateURLResponseSchema: () => GenerateURLResponseSchema,
82
96
  IncomingTriggerPayloadSchema: () => IncomingTriggerPayloadSchema,
83
97
  JSONSchemaPropertySchema: () => JSONSchemaPropertySchema,
@@ -94,13 +108,9 @@ __export(index_exports, {
94
108
  MCPSingleAppServerSchema: () => MCPSingleAppServerSchema,
95
109
  MCPToolkitConfigSchema: () => MCPToolkitConfigSchema,
96
110
  MCPToolkitConfigsArraySchema: () => MCPToolkitConfigsArraySchema,
97
- McpDeleteResponseCamelCaseSchema: () => McpDeleteResponseCamelCaseSchema,
98
111
  McpDeleteResponseSchema: () => McpDeleteResponseSchema,
99
- McpListResponseCamelCaseSchema: () => McpListResponseCamelCaseSchema,
100
112
  McpListResponseSchema: () => McpListResponseSchema,
101
- McpRetrieveResponseCamelCaseSchema: () => McpRetrieveResponseCamelCaseSchema,
102
113
  McpRetrieveResponseSchema: () => McpRetrieveResponseSchema,
103
- McpUpdateResponseCamelCaseSchema: () => McpUpdateResponseCamelCaseSchema,
104
114
  McpUpdateResponseSchema: () => McpUpdateResponseSchema,
105
115
  Oauth1ActiveConnectionDataSchema: () => Oauth1ActiveConnectionDataSchema,
106
116
  Oauth1ConnectionDataSchema: () => Oauth1ConnectionDataSchema,
@@ -152,6 +162,7 @@ __export(index_exports, {
152
162
  ValidationError: () => ValidationError,
153
163
  ValidationErrorCodes: () => ValidationErrorCodes,
154
164
  constants: () => constants_exports,
165
+ createConnectionRequest: () => createConnectionRequest,
155
166
  jsonSchemaToZodSchema: () => jsonSchemaToZodSchema,
156
167
  logger: () => logger_default,
157
168
  removeNonRequiredProperties: () => removeNonRequiredProperties
@@ -843,13 +854,18 @@ var TelemetryService = class {
843
854
  * @returns The response from the Telemetry API.
844
855
  */
845
856
  static async sendMetric(payload) {
846
- return fetch(`${TELEMETRY_URL2}/metrics/invocations`, {
847
- method: "POST",
848
- headers: {
849
- "Content-Type": "application/json"
850
- },
851
- body: JSON.stringify(payload)
852
- });
857
+ try {
858
+ const result = await fetch(`${TELEMETRY_URL2}/metrics/invocations`, {
859
+ method: "POST",
860
+ headers: {
861
+ "Content-Type": "application/json"
862
+ },
863
+ body: JSON.stringify(payload)
864
+ });
865
+ return result;
866
+ } catch (error) {
867
+ logger_default.debug("Error sending metric telemetry", error);
868
+ }
853
869
  }
854
870
  /**
855
871
  * Sends an error log to the Telemetry API.
@@ -857,13 +873,18 @@ var TelemetryService = class {
857
873
  * @returns The response from the Telemetry API.
858
874
  */
859
875
  static async sendErrorLog(payload) {
860
- return fetch(`${TELEMETRY_URL2}/errors`, {
861
- method: "POST",
862
- headers: {
863
- "Content-Type": "application/json"
864
- },
865
- body: JSON.stringify(payload)
866
- });
876
+ try {
877
+ const result = await fetch(`${TELEMETRY_URL2}/errors`, {
878
+ method: "POST",
879
+ headers: {
880
+ "Content-Type": "application/json"
881
+ },
882
+ body: JSON.stringify(payload)
883
+ });
884
+ return result;
885
+ } catch (error) {
886
+ logger_default.debug("Error sending error telemetry", error);
887
+ }
867
888
  }
868
889
  };
869
890
 
@@ -2074,6 +2095,7 @@ var readFileContent = async (path) => {
2074
2095
  try {
2075
2096
  const content = require("fs").readFileSync(path);
2076
2097
  return {
2098
+ fileName: path,
2077
2099
  content: content.toString("base64"),
2078
2100
  mimeType: "application/octet-stream"
2079
2101
  };
@@ -2091,7 +2113,8 @@ var readFileContentFromURL = async (path) => {
2091
2113
  const mimeType = response.headers.get("content-type") || "application/octet-stream";
2092
2114
  return {
2093
2115
  content: content.toString("base64"),
2094
- mimeType
2116
+ mimeType,
2117
+ fileName: path
2095
2118
  };
2096
2119
  };
2097
2120
  var uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType, client) => {
@@ -2123,17 +2146,35 @@ var uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType,
2123
2146
  }
2124
2147
  return key;
2125
2148
  };
2126
- var getFileDataAfterUploadingToS3 = async ({
2127
- path,
2149
+ var readFile = async (file) => {
2150
+ if (file instanceof File) {
2151
+ const content = await file.arrayBuffer();
2152
+ return {
2153
+ fileName: file.name,
2154
+ content: Buffer.from(content).toString("base64"),
2155
+ mimeType: file.type
2156
+ };
2157
+ } else if (typeof file === "string") {
2158
+ if (file.startsWith("http")) {
2159
+ return await readFileContentFromURL(file);
2160
+ } else {
2161
+ return await readFileContent(file);
2162
+ }
2163
+ }
2164
+ throw new Error("Invalid file type");
2165
+ };
2166
+ var getFileDataAfterUploadingToS3 = async (file, {
2128
2167
  toolSlug,
2129
2168
  toolkitSlug,
2130
2169
  client
2131
2170
  }) => {
2132
- const isURL = path.startsWith("http");
2133
- const fileData = isURL ? await readFileContentFromURL(path) : await readFileContent(path);
2134
- logger_default.debug(`Uploading file to S3: ${path}`);
2171
+ if (!file) {
2172
+ throw new Error("Either path or blob must be provided");
2173
+ }
2174
+ const fileData = await readFile(file);
2175
+ logger_default.debug(`Uploading file to S3...`);
2135
2176
  const s3key = await uploadFileToS3(
2136
- import_path.default.basename(path) || `${toolSlug}_${Date.now()}`,
2177
+ import_path.default.basename(fileData.fileName),
2137
2178
  fileData.content,
2138
2179
  toolSlug,
2139
2180
  toolkitSlug,
@@ -2142,7 +2183,7 @@ var getFileDataAfterUploadingToS3 = async ({
2142
2183
  );
2143
2184
  logger_default.debug(`Done! File uploaded to S3: ${s3key}`, JSON.stringify(fileData, null, 2));
2144
2185
  return {
2145
- name: import_path.default.basename(path) || `${toolSlug}_${Date.now()}.${fileData.mimeType.split("/")[1]}`,
2186
+ name: fileData.fileName,
2146
2187
  mimetype: fileData.mimeType,
2147
2188
  s3key
2148
2189
  };
@@ -2209,6 +2250,7 @@ var saveFile = (file, content, isTempFile = false) => {
2209
2250
  }
2210
2251
  return filePath;
2211
2252
  } catch (_error) {
2253
+ logger_default.debug(`Error saving file: ${_error}`);
2212
2254
  return null;
2213
2255
  }
2214
2256
  };
@@ -2238,10 +2280,9 @@ var transformProperties = (properties) => {
2238
2280
  };
2239
2281
  var hydrateFiles = async (value, schema, ctx) => {
2240
2282
  if (schema?.file_uploadable) {
2241
- if (typeof value !== "string") return value;
2283
+ if (typeof value !== "string" && !(value instanceof File)) return value;
2242
2284
  logger_default.debug(`Uploading file "${value}"`);
2243
- return getFileDataAfterUploadingToS3({
2244
- path: value,
2285
+ return getFileDataAfterUploadingToS3(value, {
2245
2286
  toolSlug: ctx.toolSlug,
2246
2287
  toolkitSlug: ctx.toolkitSlug,
2247
2288
  client: ctx.client
@@ -2275,7 +2316,7 @@ var hydrateDownloads = async (value, ctx) => {
2275
2316
  logger_default.debug(`Downloaded \u2192 ${dl.filePath}`);
2276
2317
  return {
2277
2318
  uri: dl.filePath,
2278
- file_downloaded: true,
2319
+ file_downloaded: dl.filePath ? true : false,
2279
2320
  s3url,
2280
2321
  mimeType: dl.mimeType
2281
2322
  };
@@ -3447,58 +3488,27 @@ var AuthConfigs = class {
3447
3488
 
3448
3489
  // src/models/ConnectionRequest.ts
3449
3490
  var import_client3 = __toESM(require("@composio/client"), 1);
3450
- var ConnectionRequest = class {
3451
- client;
3452
- id;
3453
- status;
3454
- redirectUrl;
3455
- constructor(client, connectedAccountId, status, redirectUrl) {
3456
- this.client = client;
3457
- this.id = connectedAccountId;
3458
- this.status = status || ConnectedAccountStatuses.INITIATED;
3459
- this.redirectUrl = redirectUrl;
3460
- telemetry.instrument(this);
3461
- }
3462
- /**
3463
- * Waits for the connection request to complete and become active.
3464
- *
3465
- * This method continuously polls the Composio API to check the status of the connection request
3466
- * until it either becomes active, enters a terminal error state, or times out.
3467
- *
3468
- * @param {number} [timeout=60000] - Maximum time to wait in milliseconds before timing out (default: 60 seconds)
3469
- * @returns {Promise<ConnectedAccountRetrieveResponse>} The final connected account response when successful
3470
- * @throws {ComposioConnectedAccountNotFoundError} If the connected account cannot be found
3471
- * @throws {ConnectionRequestFailedError} If the connection enters a failed, expired, or deleted state
3472
- * @throws {ConnectionRequestTimeoutError} If the connection request does not complete within the timeout period
3473
- *
3474
- * @example
3475
- * ```typescript
3476
- * // Wait for connection with default timeout (60 seconds)
3477
- * try {
3478
- * const connection = await connectionRequest.waitForConnection();
3479
- * console.log('Connection established:', connection.id);
3480
- * } catch (error) {
3481
- * console.error('Connection failed:', error.message);
3482
- * }
3483
- *
3484
- * // Wait for connection with custom timeout (2 minutes)
3485
- * const connection = await connectionRequest.waitForConnection(120000);
3486
- * ```
3487
- */
3488
- async waitForConnection(timeout = 6e4) {
3491
+ function createConnectionRequest(client, connectedAccountId, status, redirectUrl) {
3492
+ const state = {
3493
+ id: connectedAccountId,
3494
+ status: status || ConnectedAccountStatuses.INITIATED,
3495
+ redirectUrl
3496
+ };
3497
+ telemetry.instrument(state);
3498
+ async function waitForConnection(timeout = 6e4) {
3489
3499
  try {
3490
- const response = await this.client.connectedAccounts.retrieve(this.id);
3500
+ const response = await client.connectedAccounts.retrieve(state.id);
3491
3501
  if (response.status === ConnectedAccountStatuses.ACTIVE) {
3492
- this.status = ConnectedAccountStatuses.ACTIVE;
3502
+ state.status = ConnectedAccountStatuses.ACTIVE;
3493
3503
  return transformConnectedAccountResponse(response);
3494
3504
  }
3495
3505
  } catch (error) {
3496
3506
  if (error instanceof import_client3.default.NotFoundError) {
3497
3507
  throw new ComposioConnectedAccountNotFoundError(
3498
- `Connected account with id ${this.id} not found`,
3508
+ `Connected account with id ${state.id} not found`,
3499
3509
  {
3500
3510
  meta: {
3501
- connectedAccountId: this.id
3511
+ connectedAccountId: state.id
3502
3512
  }
3503
3513
  }
3504
3514
  );
@@ -3514,8 +3524,8 @@ var ConnectionRequest = class {
3514
3524
  const pollInterval = 1e3;
3515
3525
  while (Date.now() - start < timeout) {
3516
3526
  try {
3517
- const response = await this.client.connectedAccounts.retrieve(this.id);
3518
- this.status = response.status;
3527
+ const response = await client.connectedAccounts.retrieve(state.id);
3528
+ state.status = response.status;
3519
3529
  if (response.status === ConnectedAccountStatuses.ACTIVE) {
3520
3530
  return transformConnectedAccountResponse(response);
3521
3531
  }
@@ -3524,7 +3534,7 @@ var ConnectionRequest = class {
3524
3534
  `Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
3525
3535
  {
3526
3536
  meta: {
3527
- connectedAccountId: this.id,
3537
+ connectedAccountId: state.id,
3528
3538
  status: response.status,
3529
3539
  statusReason: response.status_reason
3530
3540
  }
@@ -3536,26 +3546,15 @@ var ConnectionRequest = class {
3536
3546
  throw error;
3537
3547
  }
3538
3548
  }
3539
- throw new ConnectionRequestTimeoutError(`Connection request timed out for ${this.id}`);
3540
- }
3541
- /**
3542
- * Returns a JSON-serializable representation of the connection request
3543
- * Excludes the private client property to avoid cyclic reference issues
3544
- */
3545
- toJSON() {
3546
- return {
3547
- id: this.id,
3548
- status: this.status,
3549
- redirectUrl: this.redirectUrl
3550
- };
3549
+ throw new ConnectionRequestTimeoutError(`Connection request timed out for ${state.id}`);
3551
3550
  }
3552
- /**
3553
- * Returns a string representation of the connection request
3554
- */
3555
- toString() {
3556
- return JSON.stringify(this.toJSON(), null, 2);
3557
- }
3558
- };
3551
+ return {
3552
+ ...state,
3553
+ waitForConnection,
3554
+ toJSON: () => ({ ...state }),
3555
+ toString: () => JSON.stringify(state, null, 2)
3556
+ };
3557
+ }
3559
3558
 
3560
3559
  // src/models/ConnectedAccounts.ts
3561
3560
  var ConnectedAccounts = class {
@@ -3696,7 +3695,7 @@ var ConnectedAccounts = class {
3696
3695
  }
3697
3696
  });
3698
3697
  const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
3699
- return new ConnectionRequest(
3698
+ return createConnectionRequest(
3700
3699
  this.client,
3701
3700
  response.id,
3702
3701
  response.connectionData.val.status,
@@ -3726,7 +3725,7 @@ var ConnectedAccounts = class {
3726
3725
  * ```
3727
3726
  */
3728
3727
  async waitForConnection(connectedAccountId, timeout = 6e4) {
3729
- const connectionRequest = new ConnectionRequest(this.client, connectedAccountId);
3728
+ const connectionRequest = createConnectionRequest(this.client, connectedAccountId);
3730
3729
  return connectionRequest.waitForConnection(timeout);
3731
3730
  }
3732
3731
  /**
@@ -3851,6 +3850,7 @@ var ConnectedAccounts = class {
3851
3850
  };
3852
3851
 
3853
3852
  // src/models/Toolkits.ts
3853
+ var import_openai = require("openai");
3854
3854
  var Toolkits = class {
3855
3855
  client;
3856
3856
  constructor(client) {
@@ -3971,7 +3971,7 @@ var Toolkits = class {
3971
3971
  }
3972
3972
  return parsedResult.data;
3973
3973
  } catch (error) {
3974
- if (error instanceof import_client4.default.NotFoundError) {
3974
+ if (error instanceof import_openai.APIError && (error.status === 404 || error.status === 400)) {
3975
3975
  throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
3976
3976
  meta: {
3977
3977
  slug
@@ -4955,7 +4955,7 @@ var MCPGenerateURLParamsSchema = import_zod10.z.object({
4955
4955
  connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4956
4956
  useComposioManagedAuth: import_zod10.z.boolean().optional()
4957
4957
  });
4958
- var GenerateURLParamsSnakeCaseSchema = import_zod10.z.object({
4958
+ var ComposioGenerateURLParamsSchema = import_zod10.z.object({
4959
4959
  user_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
4960
4960
  connected_account_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
4961
4961
  mcp_server_id: import_zod10.z.string(),
@@ -4965,14 +4965,14 @@ var GenerateURLParamsSchema = import_zod10.z.object({
4965
4965
  userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4966
4966
  connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
4967
4967
  mcpServerId: import_zod10.z.string(),
4968
- managedAuthByComposio: import_zod10.z.boolean().optional()
4968
+ composioManagedAuth: import_zod10.z.boolean().optional()
4969
4969
  });
4970
- var GenerateURLResponseCamelCaseSchema = import_zod10.z.object({
4970
+ var GenerateURLResponseSchema = import_zod10.z.object({
4971
4971
  connectedAccountUrls: import_zod10.z.array(import_zod10.z.string()).optional(),
4972
4972
  userIdsUrl: import_zod10.z.array(import_zod10.z.string()).optional(),
4973
4973
  mcpUrl: import_zod10.z.string().min(1, "MCP URL cannot be empty")
4974
4974
  });
4975
- var GenerateURLResponseSchema = import_zod10.z.object({
4975
+ var ComposioGenerateURLResponseSchema = import_zod10.z.object({
4976
4976
  connected_account_urls: import_zod10.z.array(import_zod10.z.string()).optional(),
4977
4977
  user_ids_url: import_zod10.z.array(import_zod10.z.string()).optional(),
4978
4978
  mcp_url: import_zod10.z.string().min(1, "MCP URL cannot be empty")
@@ -5007,21 +5007,21 @@ var MCPServerUpdateParamsSchema = import_zod10.z.object({
5007
5007
  allowedTools: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of allowed tools")
5008
5008
  });
5009
5009
  var MCPServerCreateResponseSchema = MCPServerSchema;
5010
- var CustomCreateResponseCamelCaseSchema = import_zod10.z.object({
5010
+ var CustomCreateResponseSchema = import_zod10.z.object({
5011
5011
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5012
5012
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5013
5013
  createdAt: import_zod10.z.string().nullish(),
5014
5014
  updatedAt: import_zod10.z.string().nullish(),
5015
5015
  status: import_zod10.z.string().nullish()
5016
5016
  });
5017
- var CustomCreateResponseSchema = import_zod10.z.object({
5017
+ var ComposioCustomCreateResponseSchema = import_zod10.z.object({
5018
5018
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5019
5019
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5020
5020
  created_at: import_zod10.z.string().nullish(),
5021
5021
  updated_at: import_zod10.z.string().nullish(),
5022
5022
  status: import_zod10.z.string().nullish()
5023
5023
  });
5024
- var McpListResponseCamelCaseSchema = import_zod10.z.object({
5024
+ var McpListResponseSchema = import_zod10.z.object({
5025
5025
  items: import_zod10.z.array(
5026
5026
  import_zod10.z.object({
5027
5027
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
@@ -5032,7 +5032,7 @@ var McpListResponseCamelCaseSchema = import_zod10.z.object({
5032
5032
  })
5033
5033
  ).optional()
5034
5034
  });
5035
- var McpListResponseSchema = import_zod10.z.object({
5035
+ var ComposioMcpListResponseSchema = import_zod10.z.object({
5036
5036
  items: import_zod10.z.array(
5037
5037
  import_zod10.z.object({
5038
5038
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
@@ -5043,7 +5043,7 @@ var McpListResponseSchema = import_zod10.z.object({
5043
5043
  })
5044
5044
  ).optional()
5045
5045
  });
5046
- var McpRetrieveResponseCamelCaseSchema = import_zod10.z.object({
5046
+ var McpRetrieveResponseSchema = import_zod10.z.object({
5047
5047
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5048
5048
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5049
5049
  createdAt: import_zod10.z.string().optional(),
@@ -5053,7 +5053,7 @@ var McpRetrieveResponseCamelCaseSchema = import_zod10.z.object({
5053
5053
  tools: import_zod10.z.array(import_zod10.z.string()).optional(),
5054
5054
  managedAuthViaComposio: import_zod10.z.boolean().optional()
5055
5055
  });
5056
- var McpRetrieveResponseSchema = import_zod10.z.object({
5056
+ var ComposioMcpRetrieveResponseSchema = import_zod10.z.object({
5057
5057
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5058
5058
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5059
5059
  created_at: import_zod10.z.string().optional(),
@@ -5063,17 +5063,17 @@ var McpRetrieveResponseSchema = import_zod10.z.object({
5063
5063
  tools: import_zod10.z.array(import_zod10.z.string()).optional(),
5064
5064
  managed_auth_via_composio: import_zod10.z.boolean().optional()
5065
5065
  });
5066
- var McpDeleteResponseCamelCaseSchema = import_zod10.z.object({
5066
+ var McpDeleteResponseSchema = import_zod10.z.object({
5067
5067
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5068
5068
  deleted: import_zod10.z.boolean().optional(),
5069
5069
  message: import_zod10.z.string().optional()
5070
5070
  });
5071
- var McpDeleteResponseSchema = import_zod10.z.object({
5071
+ var ComposioMcpDeleteResponseSchema = import_zod10.z.object({
5072
5072
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5073
5073
  deleted: import_zod10.z.boolean().optional(),
5074
5074
  message: import_zod10.z.string().optional()
5075
5075
  });
5076
- var McpUpdateResponseCamelCaseSchema = import_zod10.z.object({
5076
+ var McpUpdateResponseSchema = import_zod10.z.object({
5077
5077
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5078
5078
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5079
5079
  createdAt: import_zod10.z.string().optional(),
@@ -5082,7 +5082,7 @@ var McpUpdateResponseCamelCaseSchema = import_zod10.z.object({
5082
5082
  toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
5083
5083
  tools: import_zod10.z.array(import_zod10.z.string()).optional()
5084
5084
  });
5085
- var McpUpdateResponseSchema = import_zod10.z.object({
5085
+ var ComposioMcpUpdateResponseSchema = import_zod10.z.object({
5086
5086
  id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
5087
5087
  name: import_zod10.z.string().min(1, "Server name cannot be empty"),
5088
5088
  created_at: import_zod10.z.string().optional(),
@@ -5094,7 +5094,7 @@ var McpUpdateResponseSchema = import_zod10.z.object({
5094
5094
 
5095
5095
  // src/utils/transformers/mcp.ts
5096
5096
  function transformMcpCreateResponse(response) {
5097
- const result = CustomCreateResponseCamelCaseSchema.safeParse({
5097
+ const result = CustomCreateResponseSchema.safeParse({
5098
5098
  id: response.id,
5099
5099
  name: response.name,
5100
5100
  createdAt: response.created_at,
@@ -5116,7 +5116,7 @@ function transformMcpListResponse(response) {
5116
5116
  updatedAt: item.updated_at,
5117
5117
  status: item.status
5118
5118
  }));
5119
- const result = McpListResponseCamelCaseSchema.safeParse({
5119
+ const result = McpListResponseSchema.safeParse({
5120
5120
  items: transformedItems
5121
5121
  });
5122
5122
  if (!result.success) {
@@ -5127,7 +5127,7 @@ function transformMcpListResponse(response) {
5127
5127
  return result.data;
5128
5128
  }
5129
5129
  function transformMcpRetrieveResponse(response) {
5130
- const result = McpRetrieveResponseCamelCaseSchema.safeParse({
5130
+ const result = McpRetrieveResponseSchema.safeParse({
5131
5131
  id: response.id,
5132
5132
  name: response.name,
5133
5133
  createdAt: response.created_at,
@@ -5145,7 +5145,7 @@ function transformMcpRetrieveResponse(response) {
5145
5145
  return result.data;
5146
5146
  }
5147
5147
  function transformMcpDeleteResponse(response) {
5148
- const result = McpDeleteResponseCamelCaseSchema.safeParse({
5148
+ const result = McpDeleteResponseSchema.safeParse({
5149
5149
  id: response.id,
5150
5150
  deleted: response.deleted,
5151
5151
  message: response.message
@@ -5158,7 +5158,7 @@ function transformMcpDeleteResponse(response) {
5158
5158
  return result.data;
5159
5159
  }
5160
5160
  function transformMcpUpdateResponse(response) {
5161
- const result = McpUpdateResponseCamelCaseSchema.safeParse({
5161
+ const result = McpUpdateResponseSchema.safeParse({
5162
5162
  id: response.id,
5163
5163
  name: response.name,
5164
5164
  createdAt: response.created_at,
@@ -5175,7 +5175,7 @@ function transformMcpUpdateResponse(response) {
5175
5175
  return result.data;
5176
5176
  }
5177
5177
  function transformMcpGenerateUrlResponse(response) {
5178
- const result = GenerateURLResponseCamelCaseSchema.safeParse({
5178
+ const result = GenerateURLResponseSchema.safeParse({
5179
5179
  connectedAccountUrls: response.connected_account_urls,
5180
5180
  userIdsUrl: response.user_ids_url,
5181
5181
  mcpUrl: response.mcp_url
@@ -5269,7 +5269,7 @@ var MCP = class {
5269
5269
  cause: error
5270
5270
  });
5271
5271
  }
5272
- const serverResponseResult = CustomCreateResponseSchema.safeParse(mcpServerCreatedResponse);
5272
+ const serverResponseResult = ComposioCustomCreateResponseSchema.safeParse(mcpServerCreatedResponse);
5273
5273
  if (serverResponseResult.error) {
5274
5274
  throw new ValidationError("Failed to parse MCP server creation response", {
5275
5275
  cause: serverResponseResult.error
@@ -5333,7 +5333,7 @@ var MCP = class {
5333
5333
  cause: error
5334
5334
  });
5335
5335
  }
5336
- const urlResponseResult = GenerateURLResponseSchema.safeParse(data);
5336
+ const urlResponseResult = ComposioGenerateURLResponseSchema.safeParse(data);
5337
5337
  if (urlResponseResult.error) {
5338
5338
  throw new ValidationError("Failed to parse MCP URL generation response", {
5339
5339
  cause: urlResponseResult.error
@@ -5389,7 +5389,7 @@ var MCP = class {
5389
5389
  cause: error
5390
5390
  });
5391
5391
  }
5392
- const listResponseResult = McpListResponseSchema.safeParse(listResponse);
5392
+ const listResponseResult = ComposioMcpListResponseSchema.safeParse(listResponse);
5393
5393
  if (listResponseResult.error) {
5394
5394
  throw new ValidationError("Failed to parse MCP server list response", {
5395
5395
  cause: listResponseResult.error
@@ -5400,7 +5400,7 @@ var MCP = class {
5400
5400
  /**
5401
5401
  * Get details of a specific MCP server
5402
5402
  * @param {string} id - Server UUID
5403
- * @returns {Promise<ReturnType<typeof transformMcpRetrieveResponse>>} Server details
5403
+ * @returns {Promise<McpRetrieveResponse>} Server details
5404
5404
  *
5405
5405
  * @example
5406
5406
  * ```typescript
@@ -5427,7 +5427,7 @@ var MCP = class {
5427
5427
  /**
5428
5428
  * Delete an MCP server
5429
5429
  * @param {string} id - Server UUID
5430
- * @returns {Promise<ReturnType<typeof transformMcpDeleteResponse>>} Deletion response
5430
+ * @returns {Promise<McpDeleteResponse>} Deletion response
5431
5431
  *
5432
5432
  * @example
5433
5433
  * ```typescript
@@ -5443,7 +5443,7 @@ var MCP = class {
5443
5443
  cause: error
5444
5444
  });
5445
5445
  }
5446
- const deleteResponseResult = McpDeleteResponseSchema.safeParse(deleteResponse);
5446
+ const deleteResponseResult = ComposioMcpDeleteResponseSchema.safeParse(deleteResponse);
5447
5447
  if (deleteResponseResult.error) {
5448
5448
  throw new ValidationError("Failed to parse MCP server delete response", {
5449
5449
  cause: deleteResponseResult.error
@@ -5457,7 +5457,7 @@ var MCP = class {
5457
5457
  * @param {string} name - New unique name for the server
5458
5458
  * @param {MCPToolkitConfig[]} toolkitConfigs - Array of toolkit configurations
5459
5459
  * @param {MCPAuthOptions} [authOptions] - Updated authentication options
5460
- * @returns {Promise<ReturnType<typeof transformMcpUpdateResponse>>} Updated server details
5460
+ * @returns {Promise<McpUpdateResponse>} Updated server details
5461
5461
  *
5462
5462
  * @example
5463
5463
  * ```typescript
@@ -5493,7 +5493,7 @@ var MCP = class {
5493
5493
  cause: error
5494
5494
  });
5495
5495
  }
5496
- const updateResponseResult = McpUpdateResponseSchema.safeParse(updateResponse);
5496
+ const updateResponseResult = ComposioMcpUpdateResponseSchema.safeParse(updateResponse);
5497
5497
  if (updateResponseResult.error) {
5498
5498
  throw new ValidationError("Failed to parse MCP server update response", {
5499
5499
  cause: updateResponseResult.error
@@ -5504,20 +5504,20 @@ var MCP = class {
5504
5504
  /**
5505
5505
  * Generate URL for an MCP server
5506
5506
  * @param {GenerateURLParams} params - Parameters for URL generation
5507
- * @returns {Promise<ReturnType<typeof transformMcpGenerateUrlResponse>>} Generated URL response
5507
+ * @returns {Promise<GenerateURLResponse>} Generated URL response
5508
5508
  *
5509
5509
  * @example
5510
5510
  * ```typescript
5511
5511
  * const urlResponse = await composio.mcp.generateUrl({
5512
- * user_ids: ['user123'],
5513
- * connected_account_ids: ['account456'],
5514
- * mcp_server_id: 'server-uuid',
5515
- * managed_auth_by_composio: true
5512
+ * userIds: ['user123'],
5513
+ * connectedAccountIds: ['account456'],
5514
+ * mcpServerId: 'server-uuid',
5515
+ * composioManagedAuth: true
5516
5516
  * });
5517
5517
  * ```
5518
5518
  */
5519
5519
  async generateUrl(params) {
5520
- const paramsResult = GenerateURLParamsSnakeCaseSchema.safeParse(params);
5520
+ const paramsResult = GenerateURLParamsSchema.safeParse(params);
5521
5521
  if (paramsResult.error) {
5522
5522
  throw new ValidationError("Failed to parse generateUrl parameters", {
5523
5523
  cause: paramsResult.error
@@ -5525,13 +5525,18 @@ var MCP = class {
5525
5525
  }
5526
5526
  let urlResponse;
5527
5527
  try {
5528
- urlResponse = await this.client.mcp.generate.url(params);
5528
+ urlResponse = await this.client.mcp.generate.url({
5529
+ mcp_server_id: params.mcpServerId,
5530
+ user_ids: params.userIds,
5531
+ connected_account_ids: params.connectedAccountIds,
5532
+ managed_auth_by_composio: params.composioManagedAuth
5533
+ });
5529
5534
  } catch (error) {
5530
5535
  throw new ValidationError("Failed to generate MCP URL", {
5531
5536
  cause: error
5532
5537
  });
5533
5538
  }
5534
- const responseResult = GenerateURLResponseSchema.safeParse(urlResponse);
5539
+ const responseResult = ComposioGenerateURLResponseSchema.safeParse(urlResponse);
5535
5540
  if (responseResult.error) {
5536
5541
  throw new ValidationError("Failed to parse MCP URL generation response", {
5537
5542
  cause: responseResult.error
@@ -5900,9 +5905,17 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
5900
5905
  const outputs = [];
5901
5906
  for (const message of chatCompletion.choices) {
5902
5907
  if (message.message.tool_calls) {
5903
- outputs.push(
5904
- await this.executeToolCall(userId, message.message.tool_calls[0], options, modifiers)
5908
+ const toolResult = await this.executeToolCall(
5909
+ userId,
5910
+ message.message.tool_calls[0],
5911
+ options,
5912
+ modifiers
5905
5913
  );
5914
+ outputs.push({
5915
+ role: "tool",
5916
+ tool_call_id: message.message.tool_calls[0].id,
5917
+ content: toolResult
5918
+ });
5906
5919
  }
5907
5920
  }
5908
5921
  return outputs;
@@ -6122,7 +6135,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
6122
6135
  };
6123
6136
 
6124
6137
  // package.json
6125
- var version = "0.1.31";
6138
+ var version = "0.1.33";
6126
6139
 
6127
6140
  // src/models/Files.ts
6128
6141
  var Files = class {
@@ -6138,12 +6151,11 @@ var Files = class {
6138
6151
  * @returns The file data.
6139
6152
  */
6140
6153
  async upload({
6141
- filePath,
6154
+ file,
6142
6155
  toolSlug,
6143
6156
  toolkitSlug
6144
6157
  }) {
6145
- const fileData = await getFileDataAfterUploadingToS3({
6146
- path: filePath,
6158
+ const fileData = await getFileDataAfterUploadingToS3(file, {
6147
6159
  toolSlug,
6148
6160
  toolkitSlug,
6149
6161
  client: this.client
@@ -6535,12 +6547,19 @@ var AuthScheme = class {
6535
6547
  Composio,
6536
6548
  ComposioAuthConfigNotFoundError,
6537
6549
  ComposioConnectedAccountNotFoundError,
6550
+ ComposioCustomCreateResponseSchema,
6538
6551
  ComposioCustomToolsNotInitializedError,
6539
6552
  ComposioError,
6553
+ ComposioGenerateURLParamsSchema,
6554
+ ComposioGenerateURLResponseSchema,
6540
6555
  ComposioGlobalExecuteToolFnNotSetError,
6541
6556
  ComposioInvalidExecuteFunctionError,
6542
6557
  ComposioInvalidModifierError,
6543
6558
  ComposioLinkConnectionDataSchema,
6559
+ ComposioMcpDeleteResponseSchema,
6560
+ ComposioMcpListResponseSchema,
6561
+ ComposioMcpRetrieveResponseSchema,
6562
+ ComposioMcpUpdateResponseSchema,
6544
6563
  ComposioMultipleConnectedAccountsError,
6545
6564
  ComposioNoAPIKeyError,
6546
6565
  ComposioProvider,
@@ -6549,7 +6568,13 @@ var AuthScheme = class {
6549
6568
  ComposioToolNotFoundError,
6550
6569
  ComposioToolkitFetchError,
6551
6570
  ComposioToolkitNotFoundError,
6571
+ ConnectedAccountAuthConfigSchema,
6552
6572
  ConnectedAccountErrorCodes,
6573
+ ConnectedAccountListParamsSchema,
6574
+ ConnectedAccountListResponseSchema,
6575
+ ConnectedAccountRetrieveResponseSchema,
6576
+ ConnectedAccountStatusSchema,
6577
+ ConnectedAccountStatuses,
6553
6578
  ConnectionDataSchema,
6554
6579
  ConnectionRequestErrorCodes,
6555
6580
  ConnectionRequestFailedError,
@@ -6558,13 +6583,14 @@ var AuthScheme = class {
6558
6583
  CreateAuthConfigParamsSchema,
6559
6584
  CreateAuthConfigResponseSchema,
6560
6585
  CreateComposioManagedAuthConfigParamsSchema,
6586
+ CreateConnectedAccountOptionsSchema,
6587
+ CreateConnectedAccountParamsSchema,
6588
+ CreateConnectedAccountResponseSchema,
6561
6589
  CreateCustomAuthConfigParamsSchema,
6562
6590
  CustomAuthParamsSchema,
6563
- CustomCreateResponseCamelCaseSchema,
6564
6591
  CustomCreateResponseSchema,
6592
+ DefaultCreateConnectedAccountParamsSchema,
6565
6593
  GenerateURLParamsSchema,
6566
- GenerateURLParamsSnakeCaseSchema,
6567
- GenerateURLResponseCamelCaseSchema,
6568
6594
  GenerateURLResponseSchema,
6569
6595
  IncomingTriggerPayloadSchema,
6570
6596
  JSONSchemaPropertySchema,
@@ -6581,13 +6607,9 @@ var AuthScheme = class {
6581
6607
  MCPSingleAppServerSchema,
6582
6608
  MCPToolkitConfigSchema,
6583
6609
  MCPToolkitConfigsArraySchema,
6584
- McpDeleteResponseCamelCaseSchema,
6585
6610
  McpDeleteResponseSchema,
6586
- McpListResponseCamelCaseSchema,
6587
6611
  McpListResponseSchema,
6588
- McpRetrieveResponseCamelCaseSchema,
6589
6612
  McpRetrieveResponseSchema,
6590
- McpUpdateResponseCamelCaseSchema,
6591
6613
  McpUpdateResponseSchema,
6592
6614
  Oauth1ActiveConnectionDataSchema,
6593
6615
  Oauth1ConnectionDataSchema,
@@ -6639,6 +6661,7 @@ var AuthScheme = class {
6639
6661
  ValidationError,
6640
6662
  ValidationErrorCodes,
6641
6663
  constants,
6664
+ createConnectionRequest,
6642
6665
  jsonSchemaToZodSchema,
6643
6666
  logger,
6644
6667
  removeNonRequiredProperties