@composio/core 0.12.0 → 0.13.0

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.
Files changed (144) hide show
  1. package/dist/BaseProvider-Brb3o86-.d.mts +29425 -0
  2. package/dist/{CustomTool-DEB4BQPl.mjs → CustomTool-D9qwyMrv.mjs} +1 -1
  3. package/dist/{CustomTool-DH18rVQu.d.mts → CustomTool-Dmi6ti3I.d.mts} +1 -1
  4. package/dist/CustomTool-DrJpOhY2.d.mts +74 -0
  5. package/dist/{composio-CHnEggnv.d.mts → composio-DHIKRdeG.d.mts} +253 -37
  6. package/dist/composio-vMwhASRc.d.mts +5698 -0
  7. package/dist/{customTool.types-DpIdOJjL.d.mts → customTool.types-CKH2R2ia.d.mts} +344 -25
  8. package/dist/customTool.types-DXin7Cfc.d.mts +2773 -0
  9. package/dist/docs/error-consistency.md +97 -0
  10. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
  11. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
  12. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
  13. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
  14. package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
  15. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
  16. package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
  17. package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
  18. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
  19. package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
  20. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
  21. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
  22. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
  23. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
  24. package/dist/{errors-D5f4pfvI.mjs → errors-DSIlYfl5.mjs} +2 -2
  25. package/dist/experimental/index.d.mts +2 -2
  26. package/dist/experimental/index.mjs +1 -1
  27. package/dist/index.d.mts +27 -4
  28. package/dist/index.mjs +423 -123
  29. package/dist/{jsonSchema-daqF3S3d.mjs → jsonSchema-CFKdONpP.mjs} +1 -1
  30. package/dist/{types-CaI5Z4PA.d.mts → types-D4Id3wXA.d.mts} +1 -1
  31. package/dist/types-qTbYYBJw.d.mts +12 -0
  32. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  33. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  34. package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
  35. package/docs/error-consistency.md +97 -0
  36. package/package.json +4 -3
  37. package/src/composio.ts +509 -0
  38. package/src/errors/AuthConfigErrors.ts +23 -0
  39. package/src/errors/ComposioError.ts +408 -0
  40. package/src/errors/ConnectedAccountsErrors.ts +158 -0
  41. package/src/errors/ConnectionRequestErrors.ts +32 -0
  42. package/src/errors/FileModifierErrors.ts +100 -0
  43. package/src/errors/PusherErrors.ts +28 -0
  44. package/src/errors/RemoteFileErrors.ts +62 -0
  45. package/src/errors/SDKErrors.ts +92 -0
  46. package/src/errors/ToolErrors.ts +244 -0
  47. package/src/errors/ToolkitErrors.ts +39 -0
  48. package/src/errors/TriggerErrors.ts +120 -0
  49. package/src/errors/ValidationErrors.ts +99 -0
  50. package/src/errors/index.ts +41 -0
  51. package/src/experimental/index.ts +28 -0
  52. package/src/index.ts +64 -0
  53. package/src/lib/toolRouterConstants.ts +1 -0
  54. package/src/lib/toolRouterParams.ts +306 -0
  55. package/src/models/AuthConfigs.ts +398 -0
  56. package/src/models/AuthScheme.ts +206 -0
  57. package/src/models/ConnectedAccounts.ts +735 -0
  58. package/src/models/ConnectionRequest.ts +150 -0
  59. package/src/models/CustomTool.ts +676 -0
  60. package/src/models/Experimental.ts +202 -0
  61. package/src/models/Files.node.ts +93 -0
  62. package/src/models/Files.workerd.ts +49 -0
  63. package/src/models/MCP.ts +478 -0
  64. package/src/models/RemoteFile.ts +172 -0
  65. package/src/models/SessionContext.ts +147 -0
  66. package/src/models/Sessions.ts +21 -0
  67. package/src/models/ToolRouter.ts +391 -0
  68. package/src/models/ToolRouterSession.ts +827 -0
  69. package/src/models/ToolRouterSessionFileMount.ts +389 -0
  70. package/src/models/Toolkits.ts +412 -0
  71. package/src/models/Tools.ts +1260 -0
  72. package/src/models/Triggers.ts +1381 -0
  73. package/src/models/customToolExecution.ts +118 -0
  74. package/src/models/inlineCustomToolsPayload.ts +17 -0
  75. package/src/models/proxyParamsTransform.ts +26 -0
  76. package/src/provider/BaseProvider.ts +138 -0
  77. package/src/provider/ComposioProvider.ts +29 -0
  78. package/src/provider/OpenAIProvider.ts +547 -0
  79. package/src/services/internal/InternalService.ts +50 -0
  80. package/src/services/internal/InternalService.types.ts +14 -0
  81. package/src/services/pusher/Pusher.ts +230 -0
  82. package/src/services/telemetry/TelemetryService.ts +48 -0
  83. package/src/services/telemetry/TelemetryService.types.ts +67 -0
  84. package/src/telemetry/BatchProcessor.ts +77 -0
  85. package/src/telemetry/README.md +123 -0
  86. package/src/telemetry/Telemetry.ts +356 -0
  87. package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
  88. package/src/types/authConfigs.types.ts +174 -0
  89. package/src/types/composio.types.ts +1 -0
  90. package/src/types/connectedAccountAuthStates.types.ts +852 -0
  91. package/src/types/connectedAccounts.types.ts +395 -0
  92. package/src/types/connectionRequest.types.ts +16 -0
  93. package/src/types/customTool.types.ts +261 -0
  94. package/src/types/files.types.ts +15 -0
  95. package/src/types/mcp.experimental.types.ts +163 -0
  96. package/src/types/mcp.types.ts +362 -0
  97. package/src/types/modifiers.types.ts +663 -0
  98. package/src/types/org.types.ts +0 -0
  99. package/src/types/provider.types.ts +41 -0
  100. package/src/types/pusher.types.ts +18 -0
  101. package/src/types/requestOptions.types.ts +62 -0
  102. package/src/types/telemetry.types.ts +89 -0
  103. package/src/types/tool.types.ts +408 -0
  104. package/src/types/toolRouter.types.ts +761 -0
  105. package/src/types/toolkit.types.ts +130 -0
  106. package/src/types/triggers.types.ts +401 -0
  107. package/src/types/webhookEvents.types.ts +219 -0
  108. package/src/utils/buffer.ts +30 -0
  109. package/src/utils/cancellation.ts +22 -0
  110. package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
  111. package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
  112. package/src/utils/config-defaults/index.ts +1 -0
  113. package/src/utils/config-defaults/types.ts +14 -0
  114. package/src/utils/constants.ts +22 -0
  115. package/src/utils/crypto.ts +34 -0
  116. package/src/utils/env.ts +34 -0
  117. package/src/utils/fileDirs.ts +81 -0
  118. package/src/utils/fileUtils.node.ts +458 -0
  119. package/src/utils/json-schema.ts +1 -0
  120. package/src/utils/jsonSchema.ts +355 -0
  121. package/src/utils/logger.ts +99 -0
  122. package/src/utils/mime.ts +75 -0
  123. package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
  124. package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
  125. package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
  126. package/src/utils/pagination.ts +73 -0
  127. package/src/utils/pusher.ts +286 -0
  128. package/src/utils/schemaPropertyKeys.ts +433 -0
  129. package/src/utils/sdk.ts +110 -0
  130. package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
  131. package/src/utils/session.ts +114 -0
  132. package/src/utils/toolArguments.ts +73 -0
  133. package/src/utils/toolkitVersion.ts +26 -0
  134. package/src/utils/transform.ts +42 -0
  135. package/src/utils/transformers/authConfigs.ts +107 -0
  136. package/src/utils/transformers/connectedAccounts.ts +119 -0
  137. package/src/utils/transformers/mcp.ts +164 -0
  138. package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
  139. package/src/utils/transformers/toolkits.ts +100 -0
  140. package/src/utils/transformers/triggers.ts +118 -0
  141. package/src/utils/uploadDirAllowlist.node.ts +178 -0
  142. package/src/utils/uuid.ts +7 -0
  143. package/src/utils/version.ts +58 -0
  144. package/src/utils/zodSchema.ts +90 -0
@@ -0,0 +1,163 @@
1
+ import z from 'zod/v3';
2
+
3
+ export const MCPServerInstanceSchema = z.object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ type: z.literal('streamable_http'),
7
+ url: z.string(),
8
+ userId: z.string(),
9
+ allowedTools: z.array(z.string()),
10
+ authConfigs: z.array(z.string()),
11
+ });
12
+ export type MCPServerInstance = z.infer<typeof MCPServerInstanceSchema>;
13
+
14
+ /**
15
+ * MCP Create Method Input Types
16
+ */
17
+ export const MCPConfigToolkitsSchema = z.object({
18
+ toolkit: z.string().describe('Id of the toolkit').optional(),
19
+ authConfigId: z.string().describe('Id of the auth config').optional(),
20
+ });
21
+
22
+ export const MCPConfigCreationParamsSchema = z.object({
23
+ toolkits: z.array(z.union([MCPConfigToolkitsSchema, z.string()])),
24
+ allowedTools: z.array(z.string()).optional(),
25
+ manuallyManageConnections: z
26
+ .boolean()
27
+ .default(false)
28
+ .optional()
29
+ .describe(
30
+ `Whether to manually manage accounts. If true, you need to manage accounts manually connect user accounts.
31
+ If set to false, composio will inject account maangement tools into your mcp server for agents to request and authenticate accounts.
32
+ defaults to false`
33
+ ),
34
+ });
35
+ export type MCPConfigCreationParams = z.infer<typeof MCPConfigCreationParamsSchema>;
36
+
37
+ export const MCPConfigResponseSchema = z.object({
38
+ /**
39
+ * Unique identifier for the newly created custom MCP server
40
+ */
41
+ id: z.string(),
42
+
43
+ /**
44
+ * Human-readable name of the custom MCP server
45
+ */
46
+ name: z.string(),
47
+
48
+ /**
49
+ * List of tool identifiers that are enabled for this server
50
+ */
51
+ allowedTools: z.array(z.string()),
52
+
53
+ /**
54
+ * ID references to the auth configurations used by this server
55
+ */
56
+ authConfigIds: z.array(z.string()),
57
+
58
+ /**
59
+ * Set of command line instructions for connecting various clients to this MCP server
60
+ */
61
+ commands: z.object({
62
+ /**
63
+ * Command line instruction for Claude client setup
64
+ */
65
+ claude: z.string(),
66
+
67
+ /**
68
+ * Command line instruction for Cursor client setup
69
+ */
70
+ cursor: z.string(),
71
+
72
+ /**
73
+ * Command line instruction for Windsurf client setup
74
+ */
75
+ windsurf: z.string(),
76
+ }),
77
+
78
+ /**
79
+ * URL endpoint for establishing Server-Sent Events (SSE) connection to this MCP server
80
+ */
81
+ MCPUrl: z.string(),
82
+ });
83
+
84
+ export type MCPConfigResponse = z.infer<typeof MCPConfigResponseSchema>;
85
+ export interface MCPConfigCreateResponse extends MCPConfigResponse {
86
+ /**
87
+ * Creates an instance for a user of the specific MCP Server/COnfig
88
+ * @param userId {string}
89
+ * @returns {MCPServerInstance}
90
+ */
91
+ generate: (userId: string) => Promise<MCPServerInstance>;
92
+ }
93
+
94
+ export const MCPGetInstanceParamsSchema = z.object({
95
+ manuallyManageConnections: z
96
+ .boolean()
97
+ .default(false)
98
+ .optional()
99
+ .describe(
100
+ `Whether to manually manage accounts. If true, you need to manage accounts manually connect user accounts.
101
+ If set to false, composio will inject account maangement tools into your mcp server for agents to request and authenticate accounts.
102
+ defaults to false`
103
+ ),
104
+ });
105
+ export type MCPGetInstanceParams = z.infer<typeof MCPGetInstanceParamsSchema>;
106
+
107
+ export const MCPListParamsSchema = z.object({
108
+ page: z.number().optional().default(1),
109
+ limit: z.number().optional().default(10),
110
+ toolkits: z.array(z.string()).optional().default([]),
111
+ authConfigs: z.array(z.string()).optional().default([]),
112
+ name: z.string().optional(),
113
+ });
114
+ export type MCPListParams = z.infer<typeof MCPListParamsSchema>;
115
+
116
+ export const MCPItemSchema = MCPConfigResponseSchema.extend({
117
+ ...z.object({
118
+ toolkitIcons: z.record(z.string(), z.string()),
119
+ serverInstanceCount: z.number(),
120
+ toolkits: z.array(z.string()),
121
+ }).shape,
122
+ });
123
+ export type MCPItem = z.infer<typeof MCPItemSchema>;
124
+ export const MCPListResponseSchema = z.object({
125
+ items: z.array(MCPItemSchema),
126
+ currentPage: z.number(),
127
+ totalPages: z.number(),
128
+ });
129
+ export type MCPListResponse = z.infer<typeof MCPListResponseSchema>;
130
+
131
+ export const MCPUpdateParamsSchema = z.object({
132
+ name: z.string().optional(),
133
+ toolkits: z.array(z.union([MCPConfigToolkitsSchema, z.string()])).optional(),
134
+ allowedTools: z.array(z.string()).optional(),
135
+ manuallyManageConnections: z
136
+ .boolean()
137
+ .optional()
138
+ .describe(
139
+ `Whether to manually manage accounts. If true, you need to manage accounts manually connect user accounts.
140
+ If set to false, composio will inject account maangement tools into your mcp server for agents to request and authenticate accounts.
141
+ defaults to false`
142
+ ),
143
+ });
144
+ export type MCPUpdateParams = z.infer<typeof MCPUpdateParamsSchema>;
145
+
146
+ export const MCPServerConnectionStatus = z.object({
147
+ connected: z.boolean(),
148
+ toolkit: z.string(),
149
+ connectedAccountId: z.string(),
150
+ });
151
+ export type MCPServerConnectionStatus = z.infer<typeof MCPServerConnectionStatus>;
152
+
153
+ export const MCPServerConnectedAccountsSchema = z.record(
154
+ z.string(),
155
+ z.array(
156
+ z.object({
157
+ toolkit: z.string(),
158
+ authConfigId: z.string(),
159
+ connectedAccountId: z.string(),
160
+ })
161
+ )
162
+ );
163
+ export type MCPServerConnectedAccounts = z.infer<typeof MCPServerConnectedAccountsSchema>;
@@ -0,0 +1,362 @@
1
+ import {
2
+ CustomCreateResponse as CustomCreateResponseRaw,
3
+ McpCreateResponse as McpCreateResponseRaw,
4
+ GenerateURLResponse as GenerateURLResponseRaw,
5
+ } from '@composio/client/resources/mcp';
6
+ import { z } from 'zod/v3';
7
+
8
+ /**
9
+ * @deprecated
10
+ */
11
+ export const MCPToolkitConfigSchema = z.object({
12
+ toolkit: z.string().min(1, 'Toolkit name cannot be empty'),
13
+ authConfigId: z.string().min(1, 'Auth config ID cannot be empty'),
14
+ allowedTools: z
15
+ .array(z.string().min(1, 'Tool name cannot be empty'))
16
+ .min(1, 'At least one tool must be specified'),
17
+ });
18
+
19
+ export type MCPToolkitConfig = z.infer<typeof MCPToolkitConfigSchema>;
20
+ /**
21
+ * @deprecated
22
+ */
23
+ export const MCPToolkitConfigsArraySchema = z
24
+ .array(MCPToolkitConfigSchema)
25
+ .min(1, 'At least one toolkit configuration is required')
26
+ .refine(configs => {
27
+ const toolkits = configs.map(config => config.toolkit);
28
+ const uniqueToolkits = new Set(toolkits);
29
+ return uniqueToolkits.size === toolkits.length;
30
+ }, 'Duplicate toolkits are not allowed. Each toolkit must be unique.');
31
+
32
+ /**
33
+ * @deprecated
34
+ */
35
+ export const MCPAuthOptionsSchema = z.object({
36
+ isChatAuth: z.boolean().optional(),
37
+ });
38
+ export type MCPAuthOptions = z.infer<typeof MCPAuthOptionsSchema>;
39
+
40
+ export const MCPGetServerParamsSchema = z
41
+ .object({
42
+ userId: z.string().min(1, 'User ID cannot be empty').optional(),
43
+ connectedAccountIds: z
44
+ .record(z.string(), z.string().min(1, 'Account ID cannot be empty'))
45
+ .optional(),
46
+ })
47
+ .refine(
48
+ data => {
49
+ // Ensure exactly one of userId or connectedAccountIds is provided
50
+ const hasUserId = !!data.userId;
51
+ const hasConnectedAccountIds =
52
+ !!data.connectedAccountIds && Object.keys(data.connectedAccountIds).length > 0;
53
+ return hasUserId !== hasConnectedAccountIds; // XOR: exactly one should be true
54
+ },
55
+ {
56
+ message: 'Must provide either userId or connectedAccountIds, but not both',
57
+ }
58
+ );
59
+
60
+ export type MCPGetServerParams = z.infer<typeof MCPGetServerParamsSchema>;
61
+
62
+ export type MCPInstanceParams = {
63
+ serverId: string;
64
+ userIds?: string[];
65
+ connectedAccountIds?: string[];
66
+ isChatAuth?: boolean;
67
+ };
68
+
69
+ export const MCPGenerateURLParamsSchema = z.object({
70
+ userIds: z.array(z.string()).optional(),
71
+ connectedAccountIds: z.array(z.string()).optional(),
72
+ isChatAuth: z.boolean().optional(),
73
+ });
74
+ export type MCPGenerateURLParams = z.infer<typeof MCPGenerateURLParamsSchema>;
75
+
76
+ // Snake_case schema for validating the imported GenerateURLParams type
77
+ export const ComposioGenerateURLParamsSchema = z.object({
78
+ user_ids: z.array(z.string()).optional(),
79
+ connected_account_ids: z.array(z.string()).optional(),
80
+ mcp_server_id: z.string(),
81
+ managed_auth_by_composio: z.boolean().optional(),
82
+ });
83
+
84
+ export const GenerateURLParamsSchema = z.object({
85
+ userIds: z.array(z.string()).optional(),
86
+ connectedAccountIds: z.array(z.string()).optional(),
87
+ mcpServerId: z.string(),
88
+ composioManagedAuth: z.boolean().optional(),
89
+ });
90
+ export type GenerateURLParams = z.infer<typeof GenerateURLParamsSchema>;
91
+
92
+ // CamelCase response schema for generate URL
93
+ export const GenerateURLResponseSchema = z.object({
94
+ connectedAccountUrls: z.array(z.string()).optional(),
95
+ userIdsUrl: z.array(z.string()).optional(),
96
+ mcpUrl: z.string().min(1, 'MCP URL cannot be empty'),
97
+ });
98
+
99
+ // Snake_case response schema for API
100
+ export const ComposioGenerateURLResponseSchema = z.object({
101
+ connected_account_urls: z.array(z.string()).optional(),
102
+ user_ids_url: z.array(z.string()).optional(),
103
+ mcp_url: z.string().min(1, 'MCP URL cannot be empty'),
104
+ });
105
+
106
+ export type GenerateURLResponseValidated = z.infer<typeof GenerateURLResponseSchema>;
107
+
108
+ /**
109
+ * MCP Server Type (Single App)
110
+ */
111
+ export const MCPSingleAppServerSchema = z.object({
112
+ name: z.string().describe('Name of the MCP server'),
113
+ tools: z.array(z.string()).describe('List of allowed tools'),
114
+ authConfigId: z.string().optional().describe('Auth config ID for the server'),
115
+ });
116
+ export type MCPSingleAppServer = z.infer<typeof MCPSingleAppServerSchema>;
117
+
118
+ /**
119
+ * MCP Server Type (Multi App)
120
+ */
121
+ export const MCPMultiAppServerSchema = z.object({
122
+ name: z.string().describe('Name of the MCP server'),
123
+ tools: z.array(z.string()).describe('List of allowed tools across toolkits'),
124
+ toolkits: z.array(z.string()).describe('List of allowed toolkits'),
125
+ });
126
+ export type MCPMultiAppServer = z.infer<typeof MCPMultiAppServerSchema>;
127
+
128
+ /**
129
+ * MCP Server Type (Combined)
130
+ */
131
+ export const MCPServerSchema = z.object({
132
+ id: z.string().describe('Unique identifier for the MCP server'),
133
+ type: z.enum(['single', 'multi']).describe('Type of MCP server'),
134
+ createdAt: z.string().describe('Creation timestamp'),
135
+ updatedAt: z.string().describe('Last update timestamp'),
136
+ status: z.enum(['active', 'inactive', 'error']).default('active'),
137
+ config: z.union([MCPSingleAppServerSchema, MCPMultiAppServerSchema]),
138
+ });
139
+ export type MCPServer = z.infer<typeof MCPServerSchema>;
140
+
141
+ /**
142
+ * MCP Server List Response
143
+ */
144
+ export const MCPServerListResponseSchema = z.object({
145
+ items: z.array(MCPServerSchema),
146
+ total: z.number(),
147
+ page: z.number(),
148
+ pageSize: z.number(),
149
+ });
150
+ export type MCPServerListResponse = z.infer<typeof MCPServerListResponseSchema>;
151
+
152
+ /**
153
+ * MCP Server Update Parameters
154
+ */
155
+ export const MCPServerUpdateParamsSchema = z.object({
156
+ name: z.string().optional().describe('New name for the server'),
157
+ toolkits: z.array(z.string()).optional().describe('Updated list of toolkits'),
158
+ allowedTools: z.array(z.string()).optional().describe('Updated list of allowed tools'),
159
+ });
160
+ export type MCPServerUpdateParams = z.infer<typeof MCPServerUpdateParamsSchema>;
161
+
162
+ /**
163
+ * MCP Server Create Response
164
+ */
165
+ export const MCPServerCreateResponseSchema = MCPServerSchema;
166
+ export type MCPServerCreateResponse = z.infer<typeof MCPServerCreateResponseSchema>;
167
+
168
+ /**
169
+ * MCP Create Method Response Type
170
+ * Extends the API response with a getServer method for retrieving server instances
171
+ */
172
+ export type MCPCreateMethodResponse<T = GenerateURLResponseRaw> = (
173
+ | McpCreateResponseRaw
174
+ | CustomCreateResponseRaw
175
+ ) & {
176
+ toolkits: string[];
177
+ getServer: (params: MCPGetServerParams) => Promise<T>;
178
+ };
179
+
180
+ /**
181
+ * MCP Server URL Information
182
+ */
183
+ export type McpServerUrlInfo = {
184
+ url: URL;
185
+ name: string;
186
+ toolkit?: string;
187
+ };
188
+
189
+ export type McpServerGetResponse = McpServerUrlInfo | McpServerUrlInfo[];
190
+
191
+ // CamelCase URL response
192
+ export type McpUrlResponseCamelCase = {
193
+ connectedAccountUrls?: string[];
194
+ userIdsUrl?: string[];
195
+ mcpUrl: string;
196
+ };
197
+
198
+ // Snake_case URL response (for internal API use)
199
+ export type McpUrlResponse = {
200
+ name: string;
201
+ url: string;
202
+ }[];
203
+
204
+ export type McpServerCreateResponse<T> = (McpCreateResponseRaw | CustomCreateResponseRaw) & {
205
+ toolkits: string[];
206
+ getServer: (params: MCPGetServerParams) => Promise<T>;
207
+ };
208
+
209
+ export enum ConnectionStatus {
210
+ CONNECTED = 'CONNECTED',
211
+ DISCONNECTED = 'DISCONNECTED',
212
+ }
213
+
214
+ export type McpToolkitConnectionStatus =
215
+ | {
216
+ type: ConnectionStatus.CONNECTED;
217
+ connected: true;
218
+ toolkit: string;
219
+ connectedAccountId: string;
220
+ }
221
+ | {
222
+ type: ConnectionStatus.DISCONNECTED;
223
+ connected: false;
224
+ toolkit: string;
225
+ };
226
+
227
+ export type McpUserConnectionStatus =
228
+ | {
229
+ type: ConnectionStatus.CONNECTED;
230
+ connected: true;
231
+ connectedToolkits: Record<string, McpToolkitConnectionStatus>;
232
+ }
233
+ | {
234
+ type: ConnectionStatus.DISCONNECTED;
235
+ connected: false;
236
+ connectedToolkits: Record<string, McpToolkitConnectionStatus>;
237
+ };
238
+
239
+ // CamelCase create response schema
240
+ export const CustomCreateResponseSchema = z.object({
241
+ id: z.string().min(1, 'Server ID cannot be empty'),
242
+ name: z.string().min(1, 'Server name cannot be empty'),
243
+ createdAt: z.string().nullish(),
244
+ updatedAt: z.string().nullish(),
245
+ status: z.string().nullish(),
246
+ });
247
+ export type CustomCreateResponse = z.infer<typeof CustomCreateResponseSchema>;
248
+
249
+ // Snake_case create response schema (for API)
250
+ export const ComposioCustomCreateResponseSchema = z.object({
251
+ id: z.string().min(1, 'Server ID cannot be empty'),
252
+ name: z.string().min(1, 'Server name cannot be empty'),
253
+ created_at: z.string().nullish(),
254
+ updated_at: z.string().nullish(),
255
+ status: z.string().nullish(),
256
+ });
257
+
258
+ export type CustomCreateResponseValidated = z.infer<typeof CustomCreateResponseSchema>;
259
+
260
+ // CamelCase list response schema
261
+ export const McpListResponseSchema = z.object({
262
+ items: z
263
+ .array(
264
+ z.object({
265
+ id: z.string().min(1, 'Server ID cannot be empty'),
266
+ name: z.string().min(1, 'Server name cannot be empty'),
267
+ createdAt: z.string().optional(),
268
+ updatedAt: z.string().optional(),
269
+ status: z.string().optional(),
270
+ })
271
+ )
272
+ .optional(),
273
+ });
274
+
275
+ // Snake_case list response schema (for API)
276
+ export const ComposioMcpListResponseSchema = z.object({
277
+ items: z
278
+ .array(
279
+ z.object({
280
+ id: z.string().min(1, 'Server ID cannot be empty'),
281
+ name: z.string().min(1, 'Server name cannot be empty'),
282
+ created_at: z.string().optional(),
283
+ updated_at: z.string().optional(),
284
+ status: z.string().optional(),
285
+ })
286
+ )
287
+ .optional(),
288
+ });
289
+
290
+ // CamelCase retrieve response schema
291
+ export const McpRetrieveResponseSchema = z.object({
292
+ id: z.string().min(1, 'Server ID cannot be empty'),
293
+ name: z.string().min(1, 'Server name cannot be empty'),
294
+ createdAt: z.string().optional(),
295
+ updatedAt: z.string().optional(),
296
+ status: z.string().optional(),
297
+ toolkits: z.array(z.string()).optional(),
298
+ tools: z.array(z.string()).optional(),
299
+ managedAuthViaComposio: z.boolean().optional(),
300
+ authConfigIds: z.array(z.string()).optional(),
301
+ mcpUrl: z.string(),
302
+ commands: z.object({
303
+ claude: z.string(),
304
+ cursor: z.string(),
305
+ windsurf: z.string(),
306
+ }),
307
+ });
308
+
309
+ // Snake_case retrieve response schema (for API)
310
+ export const ComposioMcpRetrieveResponseSchema = z.object({
311
+ id: z.string().min(1, 'Server ID cannot be empty'),
312
+ name: z.string().min(1, 'Server name cannot be empty'),
313
+ created_at: z.string().optional(),
314
+ updated_at: z.string().optional(),
315
+ status: z.string().optional(),
316
+ toolkits: z.array(z.string()).optional(),
317
+ tools: z.array(z.string()).optional(),
318
+ managed_auth_via_composio: z.boolean().optional(),
319
+ });
320
+
321
+ // CamelCase delete response schema
322
+ export const McpDeleteResponseSchema = z.object({
323
+ id: z.string().min(1, 'Server ID cannot be empty'),
324
+ deleted: z.boolean().optional(),
325
+ message: z.string().optional(),
326
+ });
327
+
328
+ // Snake_case delete response schema (for API)
329
+ export const ComposioMcpDeleteResponseSchema = z.object({
330
+ id: z.string().min(1, 'Server ID cannot be empty'),
331
+ deleted: z.boolean().optional(),
332
+ message: z.string().optional(),
333
+ });
334
+
335
+ // CamelCase update response schema
336
+ export const McpUpdateResponseSchema = z.object({
337
+ id: z.string().min(1, 'Server ID cannot be empty'),
338
+ name: z.string().min(1, 'Server name cannot be empty'),
339
+ createdAt: z.string().optional(),
340
+ updatedAt: z.string().optional(),
341
+ status: z.string().optional(),
342
+ toolkits: z.array(z.string()).optional(),
343
+ tools: z.array(z.string()).optional(),
344
+ });
345
+
346
+ // Snake_case update response schema (for API)
347
+ export const ComposioMcpUpdateResponseSchema = z.object({
348
+ id: z.string().min(1, 'Server ID cannot be empty'),
349
+ name: z.string().min(1, 'Server name cannot be empty'),
350
+ created_at: z.string().optional(),
351
+ updated_at: z.string().optional(),
352
+ status: z.string().optional(),
353
+ toolkits: z.array(z.string()).optional(),
354
+ tools: z.array(z.string()).optional(),
355
+ });
356
+
357
+ // Export camelCase response types
358
+ export type McpListResponse = z.infer<typeof McpListResponseSchema>;
359
+ export type McpRetrieveResponse = z.infer<typeof McpRetrieveResponseSchema>;
360
+ export type McpDeleteResponse = z.infer<typeof McpDeleteResponseSchema>;
361
+ export type McpUpdateResponse = z.infer<typeof McpUpdateResponseSchema>;
362
+ export type GenerateURLResponse = z.infer<typeof GenerateURLResponseSchema>;