Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Fix toolss.get to support scopes, remove cursor and important flags (#1666)
Musthaq Ahamad committed
Jun 19, 2025 at 13:24 UTC
deca04ed12e1daf8c329590fb7cc40a092c39789
14 files changed
+188
-186
pnpm-lock.yaml
+12
-12
@@ -482,7 +482,7 @@ importers:
482
version: 3.16.8
483
effect-errors:
484
specifier: ^1.10.11
485
- version: 1.10.11(krha7h4zqwvrjoe7foerbk5wme)
485
+ version: 1.10.11(ff5edfb43a1891ed491370151a2c33b9)
486
indent-string:
487
specifier: ^5.0.0
488
version: 5.0.0
@@ -527,8 +527,8 @@ importers:
527
ts/packages/core:
528
dependencies:
529
'@composio/client':
530
- specifier: 0.1.0-alpha.23
531
- version: 0.1.0-alpha.23
530
+ specifier: 0.1.0-alpha.24
531
+ version: 0.1.0-alpha.24
532
'@composio/json-schema-to-zod':
533
specifier: 0.1.9
534
version: 0.1.9
@@ -650,7 +650,7 @@ importers:
650
dependencies:
651
'@langchain/core':
652
specifier: ^0.3.44
653
- version: 0.3.58(openai@5.3.0(zod@3.25.62))
653
+ version: 0.3.58(openai@5.3.0(ws@8.18.2)(zod@3.25.62))
654
devDependencies:
655
'@composio/core':
656
specifier: workspace:*
@@ -1027,8 +1027,8 @@ packages:
1027
'@composio/client@0.1.0-alpha.22':
1028
resolution: {integrity: sha512-b9KCO5gy0EsCG+nXikOdm17PiZZ85rw3vwu9aNRIse9rEj2FA1SScpP+P9GN4G0lQHl+QPyDuVvGa6U9AATFeg==}
1029
1030
- '@composio/client@0.1.0-alpha.23':
1031
- resolution: {integrity: sha512-zDbOJZVR+Ug0a622mjMGsREELKOG6DLF3qKI7qJ9FLP/GpAT7xekyEE7DR0g37zs6ytCy0oV/KMi+KaxxNp+zA==}
1030
+ '@composio/client@0.1.0-alpha.24':
1031
+ resolution: {integrity: sha512-CC8drumVzTNZP6Hh9eR69MTwXR2UBmsPPgLgvTZUtBI5qVatjpEl018prMQXuWIzDa9eOKhQnUDNjU52cqo4sQ==}
1032
1033
'@composio/core@0.1.22':
1034
resolution: {integrity: sha512-ehu0OdwAgjShWjRaXBVlFnaqykDj6rxWcH3GeE179luNqLIb1p0L+Nazb1IMJ1CFl+DQC/NWkI80K8lgRLBQNQ==}
@@ -6434,7 +6434,7 @@ snapshots:
6434
6435
'@composio/client@0.1.0-alpha.22': {}
6436
6437
- '@composio/client@0.1.0-alpha.23': {}
6437
+ '@composio/client@0.1.0-alpha.24': {}
6438
6439
'@composio/core@0.1.22(ws@8.18.2)':
6440
dependencies:
@@ -7023,14 +7023,14 @@ snapshots:
7023
transitivePeerDependencies:
7024
- openai
7025
7026
- '@langchain/core@0.3.58(openai@5.3.0(zod@3.25.62))':
7026
+ '@langchain/core@0.3.58(openai@5.3.0(ws@8.18.2)(zod@3.25.62))':
7027
dependencies:
7028
'@cfworker/json-schema': 4.1.1
7029
ansi-styles: 5.2.0
7030
camelcase: 6.3.0
7031
decamelize: 1.2.0
7032
js-tiktoken: 1.0.20
7033
- langsmith: 0.3.31(openai@5.3.0(zod@3.25.62))
7033
+ langsmith: 0.3.31(openai@5.3.0(ws@8.18.2)(zod@3.25.62))
7034
mustache: 4.2.0
7035
p-queue: 6.6.2
7036
p-retry: 4.6.2
@@ -8827,7 +8827,7 @@ snapshots:
8827
sirv: 3.0.1
8828
tinyglobby: 0.2.14
8829
tinyrainbow: 2.0.0
8830
- vitest: 3.2.3(@types/node@20.19.1)(@vitest/ui@3.2.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
8830
+ vitest: 3.2.3(@types/node@24.0.3)(@vitest/ui@3.2.3)(jiti@1.21.7)(tsx@4.20.1)(yaml@2.8.0)
8831
8832
'@vitest/utils@3.2.3':
8833
dependencies:
@@ -9314,7 +9314,7 @@ snapshots:
9314
9315
ee-first@1.1.1: {}
9316
9317
- effect-errors@1.10.11(krha7h4zqwvrjoe7foerbk5wme):
9317
+ effect-errors@1.10.11(ff5edfb43a1891ed491370151a2c33b9):
9318
dependencies:
9319
'@effect/cluster': 0.39.2(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/sql@0.38.1(@effect/experimental@0.49.1(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(@effect/workflow@0.2.2(@effect/platform@0.84.11(effect@3.16.8))(@effect/rpc@0.62.2(@effect/platform@0.84.11(effect@3.16.8))(effect@3.16.8))(effect@3.16.8))(effect@3.16.8)
9320
'@effect/platform': 0.84.11(effect@3.16.8)
@@ -10134,7 +10134,7 @@ snapshots:
10134
optionalDependencies:
10135
openai: 4.104.0(ws@8.18.2)(zod@3.25.62)
10136
10137
- langsmith@0.3.31(openai@5.3.0(zod@3.25.62)):
10137
+ langsmith@0.3.31(openai@5.3.0(ws@8.18.2)(zod@3.25.62)):
10138
dependencies:
10139
'@types/uuid': 10.0.0
10140
chalk: 4.1.2
ts/packages/core/package.json
+1
-1
@@ -37,7 +37,7 @@
37
"vitest": "^3.1.4"
38
},
39
"dependencies": {
40
- "@composio/client": "0.1.0-alpha.23",
40
+ "@composio/client": "0.1.0-alpha.24",
41
"@composio/json-schema-to-zod": "0.1.9",
42
"chalk": "^5.4.1",
43
"openai": "^4.94.0",
ts/packages/core/src/models/AuthScheme.ts
-14
@@ -190,20 +190,6 @@ export class AuthScheme {
190
};
191
}
192
193
- /**
194
- * Creates a ConnectionData object for Snowflake authentication
195
- * @returns ConnectionData object
196
- */
197
- static Snowflake(params: BaseConnectionFields): ConnectionData {
198
- return {
199
- authScheme: AuthSchemeTypes.SNOWFLAKE,
200
- val: {
201
- status: ConnectionStatuses.ACTIVE,
202
- ...params,
203
- },
204
- };
205
- }
206
-
193
/**
194
* Creates a ConnectionData object for Bill.com authentication
195
* @param params The Bill.com auth parameters
ts/packages/core/src/models/ConnectedAccounts.ts
-1
@@ -178,7 +178,6 @@ export class ConnectedAccounts {
178
id: authConfigId,
179
},
180
connection: {
181
- state: options?.config,
181
callback_url: options?.callbackUrl,
182
user_id: userId,
183
},
ts/packages/core/src/models/Tools.ts
+29
-17
@@ -20,6 +20,7 @@ import {
20
ToolRetrieveResponse,
21
ToolListResponse as ComposioToolListResponse,
22
ToolExecuteResponse as ComposioToolExecuteResponse,
23
+ ToolListParams as ComposioToolListParams,
24
} from '@composio/client/resources/tools';
25
import { CustomTools } from './CustomTools';
26
import { CustomToolInputParameter, CustomToolOptions } from '../types/customTool.types';
@@ -235,7 +236,7 @@ export class Tools<
236
* // Get tools with filters
237
* const githubTools = await composio.tools.getRawComposioTools({
238
* toolkits: ['github'],
238
- * important: true
239
+ * limit: 10
240
* });
241
*
242
* // Get tools with schema transformation
@@ -282,20 +283,20 @@ export class Tools<
283
limit = '9999';
284
}
285
285
- const tools = await this.client.tools.list({
286
- tool_slugs: 'tools' in queryParams.data ? queryParams.data.tools?.join(',') : undefined,
287
- toolkit_slug:
288
- 'toolkits' in queryParams.data ? queryParams.data.toolkits?.join(',') : undefined,
289
- cursor: 'cursor' in queryParams.data ? queryParams.data.cursor : undefined,
290
- important:
291
- 'important' in queryParams.data
292
- ? queryParams.data.important
293
- ? 'true'
294
- : 'false'
295
- : undefined,
296
- limit: limit,
297
- search: 'search' in queryParams.data ? queryParams.data.search : undefined,
298
- });
286
+ const filters: ComposioToolListParams = {
287
+ ...('tools' in queryParams.data ? { tool_slugs: queryParams.data.tools?.join(',') } : {}),
288
+ ...('toolkits' in queryParams.data
289
+ ? { toolkit_slug: queryParams.data.toolkits?.join(',') }
290
+ : {}),
291
+ ...(limit ? { limit } : {}),
292
+ ...('tags' in queryParams.data ? { tags: queryParams.data.tags } : {}),
293
+ ...('scopes' in queryParams.data ? { scopes: queryParams.data.scopes } : {}),
294
+ ...('search' in queryParams.data ? { search: queryParams.data.search } : {}),
295
+ };
296
+
297
+ logger.info(`Fetching tools with filters: ${JSON.stringify(filters, null, 2)}`);
298
+
299
+ const tools = await this.client.tools.list(filters);
300
301
if (!tools) {
302
return [];
@@ -387,9 +388,20 @@ export class Tools<
388
* });
389
*
390
* // Get tools with search
390
- * const tools = await composio.tools.get('default', {
391
+ * const searchTools = await composio.tools.get('default', {
392
* search: 'user',
392
- * important: true
393
+ * limit: 10
394
+ * });
395
+ *
396
+ * // Get a specific tool by slug
397
+ * const hackerNewsUserTool = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
398
+ *
399
+ * // Get a tool with schema modifications
400
+ * const tool = await composio.tools.get('default', 'GITHUB_GET_REPOS', {
401
+ * modifySchema: (toolSlug, toolkitSlug, schema) => {
402
+ * // Customize the tool schema
403
+ * return {...schema, description: 'Custom description'};
404
+ * }
405
* });
406
* ```
407
*/
ts/packages/core/src/types/authConfigs.types.ts
-2
@@ -19,7 +19,6 @@ export const AuthSchemeTypes = {
19
BASIC_WITH_JWT: 'BASIC_WITH_JWT',
20
COMPOSIO_LINK: 'COMPOSIO_LINK',
21
CALCOM_AUTH: 'CALCOM_AUTH',
22
- SNOWFLAKE: 'SNOWFLAKE',
22
} as const;
23
export type AuthSchemeType = (typeof AuthSchemeTypes)[keyof typeof AuthSchemeTypes];
24
@@ -35,7 +34,6 @@ export const AuthSchemeEnum = z.enum([
34
'BASIC_WITH_JWT',
35
'COMPOSIO_LINK',
36
'CALCOM_AUTH',
38
- 'SNOWFLAKE',
37
]);
38
export const CreateCustomAuthConfigParamsSchema = z.object({
39
type: z.literal('use_custom_auth'),
ts/packages/core/src/types/connectedAccountAuthStates.types.ts
+22
-22
@@ -352,21 +352,21 @@ const CalcomAuthConnectionDataSchema = z.discriminatedUnion('status', [
352
]);
353
354
// SNOWFLAKE
355
-const SnowflakeInitiatingSchema = BaseSchemeRaw.extend({
356
- status: z.literal(ConnectionStatuses.ACTIVE),
357
-}).catchall(z.unknown());
358
-const SnowflakeConnectionDataSchema = z.discriminatedUnion('status', [
359
- SnowflakeInitiatingSchema,
360
- SnowflakeInitiatingSchema.extend({
361
- status: z.literal(ConnectionStatuses.FAILED),
362
- error: z.string().optional(),
363
- error_description: z.string().optional(),
364
- }).catchall(z.unknown()),
365
- SnowflakeInitiatingSchema.extend({
366
- status: z.literal(ConnectionStatuses.EXPIRED),
367
- expired_at: z.string().optional(),
368
- }).catchall(z.unknown()),
369
-]);
355
+// const SnowflakeInitiatingSchema = BaseSchemeRaw.extend({
356
+// status: z.literal(ConnectionStatuses.ACTIVE),
357
+// }).catchall(z.unknown());
358
+// const SnowflakeConnectionDataSchema = z.discriminatedUnion('status', [
359
+// SnowflakeInitiatingSchema,
360
+// SnowflakeInitiatingSchema.extend({
361
+// status: z.literal(ConnectionStatuses.FAILED),
362
+// error: z.string().optional(),
363
+// error_description: z.string().optional(),
364
+// }).catchall(z.unknown()),
365
+// SnowflakeInitiatingSchema.extend({
366
+// status: z.literal(ConnectionStatuses.EXPIRED),
367
+// expired_at: z.string().optional(),
368
+// }).catchall(z.unknown()),
369
+// ]);
370
371
export const ConnectionDataSchema = z.discriminatedUnion('authScheme', [
372
z.object({
@@ -432,13 +432,13 @@ export const ConnectionDataSchema = z.discriminatedUnion('authScheme', [
432
*/
433
val: CalcomAuthConnectionDataSchema,
434
}),
435
- z.object({
436
- authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
437
- /**
438
- * the main connection data discriminated by auth scheme
439
- */
440
- val: SnowflakeConnectionDataSchema,
441
- }),
435
+ // z.object({
436
+ // authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
437
+ // /**
438
+ // * the main connection data discriminated by auth scheme
439
+ // */
440
+ // val: SnowflakeConnectionDataSchema,
441
+ // }),
442
z.object({
443
authScheme: z.literal(AuthSchemeTypes.BILLCOM_AUTH),
444
/**
ts/packages/core/src/types/connectedAccounts.types.ts
-32
@@ -62,38 +62,6 @@ export const CreateConnectedAccountResponseSchema = z.object({
62
});
63
export type CreateConnectedAccountResponse = z.infer<typeof CreateConnectedAccountResponseSchema>;
64
65
-export const ConnectedAccountAuthSchemes = {
66
- OAUTH1: 'OAUTH1',
67
- OAUTH2: 'OAUTH2',
68
- COMPOSIO_LINK: 'COMPOSIO_LINK',
69
- API_KEY: 'API_KEY',
70
- BASIC: 'BASIC',
71
- BEARER_TOKEN: 'BEARER_TOKEN',
72
- GOOGLE_SERVICE_ACCOUNT: 'GOOGLE_SERVICE_ACCOUNT',
73
- NO_AUTH: 'NO_AUTH',
74
- CALCOM_AUTH: 'CALCOM_AUTH',
75
- SNOWFLAKE: 'SNOWFLAKE',
76
- BILLCOM_AUTH: 'BILLCOM_AUTH',
77
- BASIC_WITH_JWT: 'BASIC_WITH_JWT',
78
-} as const;
79
-export const ConnectedAccountAuthSchemesSchema = z.enum([
80
- ConnectedAccountAuthSchemes.OAUTH2,
81
- ConnectedAccountAuthSchemes.OAUTH1,
82
- ConnectedAccountAuthSchemes.API_KEY,
83
- ConnectedAccountAuthSchemes.BASIC,
84
- ConnectedAccountAuthSchemes.BILLCOM_AUTH,
85
- ConnectedAccountAuthSchemes.BEARER_TOKEN,
86
- ConnectedAccountAuthSchemes.GOOGLE_SERVICE_ACCOUNT,
87
- ConnectedAccountAuthSchemes.NO_AUTH,
88
- ConnectedAccountAuthSchemes.BASIC_WITH_JWT,
89
- ConnectedAccountAuthSchemes.COMPOSIO_LINK,
90
- ConnectedAccountAuthSchemes.CALCOM_AUTH,
91
- ConnectedAccountAuthSchemes.SNOWFLAKE,
92
-]);
93
-export type ConnectedAccountAuthSchemesEnum = z.infer<typeof ConnectedAccountAuthSchemesSchema>;
94
-export type ConnectedAccountAuthSchemes =
95
- (typeof ConnectedAccountAuthSchemes)[keyof typeof ConnectedAccountAuthSchemes];
96
-
65
export const ConnectedAccountAuthConfigSchema = z.object({
66
id: z.string(),
67
isComposioManaged: z.boolean(),
ts/packages/core/src/types/tool.types.ts
+46
-37
@@ -108,6 +108,7 @@ export const ToolSchema = z.object({
108
tags: z.optional(z.array(z.string())).describe('The tags of the tool. eg: Important').default([]),
109
toolkit: z.optional(ToolkitSchema).describe('The toolkit of the tool'),
110
version: z.optional(z.string()).describe('The version of the tool, e.g. "1.0.0"'),
111
+ scopes: z.optional(z.array(z.string())).describe('The scopes of the tool. eg: ["task:add"]'),
112
});
113
export type Tool = z.infer<typeof ToolSchema>;
114
@@ -126,65 +127,73 @@ export type ToolListResponse = z.infer<typeof ToolListResponseSchema>;
127
*/
128
export type ToolList = Array<Tool>;
129
129
-export const ToolListFilterByToolsSchema = z.object({
130
- tools: z.array(z.string()),
131
-});
132
-export type ToolListFilterByTools = z.infer<typeof ToolListFilterByToolsSchema>;
133
-
134
-export const ToolListFilterByToolkitsSchema = z.object({
135
- toolkits: z.array(z.string()),
136
- important: z.boolean().optional(),
137
- cursor: z.string().optional(),
130
+export const ToolListParamsSchema = z.object({
131
+ tools: z.array(z.string()).optional(),
132
+ toolkits: z.array(z.string()).optional(),
133
+ scopes: z.array(z.string()).optional(),
134
+ tags: z.array(z.string()).optional(),
135
limit: z.number().optional(),
136
search: z.string().optional(),
137
});
141
-export type ToolListFilterByToolkits = z.infer<typeof ToolListFilterByToolkitsSchema>;
138
143
-export const ToolListFilterBySearchSchema = z.object({
144
- search: z.string(),
145
- toolkits: z.array(z.string()).optional(),
146
- cursor: z.string().optional(),
147
- limit: z.number().optional(),
148
-});
149
-export type ToolListFilterBySearch = z.infer<typeof ToolListFilterBySearchSchema>;
139
+type BaseParams = {
140
+ limit?: number;
141
+ search?: string;
142
+ scopes?: string[];
143
+ tags?: string[];
144
+};
145
146
+// tools only
147
type ToolsOnlyParams = {
148
tools: string[];
149
toolkits?: never;
154
- important?: never;
155
- cursor?: never;
156
- limit?: never;
150
+ scopes?: never;
151
search?: never;
152
+ tags?: never;
153
};
154
155
+// toolkits only
156
type ToolkitsOnlyParams = {
157
+ toolkits: string[];
158
+ tools?: never;
159
+ scopes?: never;
160
+} & Pick<BaseParams, 'limit' | 'search' | 'tags'>;
161
+
162
+// toolkit + scopes (single toolkit only)
163
+type ToolkitScopeOnlyParams = {
164
+ toolkits: [string];
165
tools?: never;
166
+ scopes: string[];
167
+} & Pick<BaseParams, 'limit' | 'search' | 'tags'>;
168
+
169
+// tags only
170
+type TagsOnlyParams = {
171
toolkits?: string[];
163
- important?: boolean;
164
- cursor?: string;
165
- limit?: number;
172
+ tags: string[];
173
+ tools?: never;
174
search?: never;
167
-};
175
+} & Pick<BaseParams, 'limit'>;
176
169
-type ToolkitSearchOnlyParams = {
177
+// search only
178
+type SearchOnlyParams = {
179
tools?: never;
171
- toolkits?: string[];
172
- important?: never;
173
- cursor?: string;
174
- limit?: number;
175
- search?: string;
180
+ toolkits?: never;
181
+ scopes?: never;
182
+ limit?: never;
183
+ search: string;
184
+ tags?: never;
185
};
186
+
187
/**
188
* ToolListParams is the parameters for the list of tools.
189
* You must provide either tools or toolkits, but not both.
190
*/
181
-export type ToolListParams = ToolsOnlyParams | ToolkitsOnlyParams | ToolkitSearchOnlyParams;
182
-
183
-export const ToolListParamsSchema = z.union([
184
- ToolListFilterByToolsSchema,
185
- ToolListFilterByToolkitsSchema,
186
- ToolListFilterBySearchSchema,
187
-]);
191
+export type ToolListParams =
192
+ | ToolsOnlyParams
193
+ | ToolkitsOnlyParams
194
+ | ToolkitScopeOnlyParams
195
+ | SearchOnlyParams
196
+ | TagsOnlyParams;
197
198
/**
199
* CustomAuthParams is the parameters for the custom authentication.
ts/packages/core/test/AuthConfigs/AuthScheme.test.ts
-16
@@ -259,22 +259,6 @@ describe('AuthScheme', () => {
259
});
260
});
261
262
- describe('Snowflake', () => {
263
- it('should create Snowflake connection data', () => {
264
- const result = AuthScheme.Snowflake();
265
-
266
- expect(result).toEqual({
267
- authScheme: AuthSchemeTypes.SNOWFLAKE,
268
- val: {
269
- status: ConnectionStatuses.ACTIVE,
270
- },
271
- });
272
-
273
- // Verify Zod schema validation
274
- expect(() => ConnectionDataSchema.parse(result)).not.toThrow();
275
- });
276
- });
277
-
262
describe('BillcomAuth', () => {
263
it('should create BillcomAuth connection data', () => {
264
const params = {
ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
+14
-17
@@ -5,12 +5,9 @@ import ComposioClient from '@composio/client';
5
import { ConnectionRequest } from '../../src/models/ConnectionRequest';
6
import { ConnectedAccountRetrieveResponse } from '@composio/client/resources/connected-accounts.mjs';
7
import { ComposioConnectedAccountNotFoundError } from '../../src/errors';
8
-import { ConnectionStatusEnum } from '../../src/types/connectedAccountAuthStates.types';
9
-import {
10
- ConnectedAccountAuthSchemes,
11
- ConnectedAccountStatuses,
12
-} from '../../src/types/connectedAccounts.types';
8
+import { ConnectedAccountStatuses } from '../../src/types/connectedAccounts.types';
9
import { ComposioMultipleConnectedAccountsError } from '../../src/errors';
10
+import { AuthSchemeTypes } from '../../src/types/authConfigs.types';
11
12
// Extend the mock client object for ConnectedAccounts testing
13
const extendedMockClient = {
@@ -97,7 +94,7 @@ describe('ConnectedAccounts', () => {
94
id: 'conn_123',
95
connectionData: {
96
val: {
100
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
97
+ authScheme: AuthSchemeTypes.OAUTH2,
98
status: 'INITIALIZING',
99
redirectUrl: 'https://auth.example.com/connect',
100
},
@@ -137,7 +134,7 @@ describe('ConnectedAccounts', () => {
134
id: 'conn_123',
135
connectionData: {
136
val: {
140
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
137
+ authScheme: AuthSchemeTypes.OAUTH2,
138
status: 'INITIALIZING',
139
redirectUrl: 'https://auth.example.com/connect',
140
},
@@ -271,7 +268,7 @@ describe('ConnectedAccounts', () => {
268
id: 'conn_123',
269
connectionData: {
270
val: {
274
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
271
+ authScheme: AuthSchemeTypes.OAUTH2,
272
status: 'INITIALIZING',
273
redirectUrl: 'https://auth.example.com/connect',
274
},
@@ -312,7 +309,7 @@ describe('ConnectedAccounts', () => {
309
is_disabled: false,
310
},
311
state: {
315
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
312
+ authScheme: AuthSchemeTypes.OAUTH2,
313
val: {
314
status: 'ACTIVE',
315
access_token: 'access_token_123',
@@ -345,7 +342,7 @@ describe('ConnectedAccounts', () => {
342
isDisabled: false,
343
},
344
state: {
348
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
345
+ authScheme: AuthSchemeTypes.OAUTH2,
346
val: {
347
status: 'ACTIVE',
348
access_token: 'access_token_123',
@@ -454,12 +451,12 @@ describe('ConnectedAccounts', () => {
451
auth_scopes: ['read:user', 'write:user'],
452
auth_config: {
453
id: authConfigId,
457
- auth_scheme: ConnectedAccountAuthSchemes.OAUTH2,
454
+ auth_scheme: AuthSchemeTypes.OAUTH2,
455
is_composio_managed: true,
456
is_disabled: false,
457
},
458
state: {
462
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
459
+ authScheme: AuthSchemeTypes.OAUTH2,
460
val: {
461
status: ConnectedAccountStatuses.INITIALIZING,
462
access_token: 'access_token_123',
@@ -482,7 +479,7 @@ describe('ConnectedAccounts', () => {
479
...mockGetResponse,
480
status: ConnectedAccountStatuses.ACTIVE,
481
state: {
485
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
482
+ authScheme: AuthSchemeTypes.OAUTH2,
483
val: {
484
status: ConnectedAccountStatuses.ACTIVE,
485
access_token: 'access_token_123',
@@ -508,7 +505,7 @@ describe('ConnectedAccounts', () => {
505
isDisabled: false,
506
},
507
state: {
511
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
508
+ authScheme: AuthSchemeTypes.OAUTH2,
509
val: {
510
status: ConnectedAccountStatuses.ACTIVE,
511
access_token: 'access_token_123',
@@ -554,7 +551,7 @@ describe('ConnectedAccounts', () => {
551
is_disabled: false,
552
},
553
state: {
557
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
554
+ authScheme: AuthSchemeTypes.OAUTH2,
555
val: {
556
status: ConnectedAccountStatuses.INITIALIZING,
557
access_token: 'access_token_123',
@@ -578,7 +575,7 @@ describe('ConnectedAccounts', () => {
575
...mockGetResponse,
576
status: 'ACTIVE',
577
state: {
581
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
578
+ authScheme: AuthSchemeTypes.OAUTH2,
579
val: {
580
status: ConnectedAccountStatuses.ACTIVE,
581
access_token: 'access_token_123',
@@ -602,7 +599,7 @@ describe('ConnectedAccounts', () => {
599
isDisabled: false,
600
},
601
state: {
605
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
602
+ authScheme: AuthSchemeTypes.OAUTH2,
603
val: {
604
status: ConnectedAccountStatuses.ACTIVE,
605
access_token: 'access_token_123',
ts/packages/core/test/connectedAccounts/connectionRequest.test.ts
+3
-5
@@ -2,10 +2,8 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
import { ConnectionRequest } from '../../src/models/ConnectionRequest';
3
import ComposioClient, { ComposioError } from '@composio/client';
4
import { ConnectionRequestTimeoutError } from '../../src/errors';
5
-import {
6
- ConnectedAccountAuthSchemes,
7
- ConnectedAccountStatuses,
8
-} from '../../src/types/connectedAccounts.types';
5
+import { ConnectedAccountStatuses } from '../../src/types/connectedAccounts.types';
6
+import { AuthSchemeTypes } from '../../src/types/authConfigs.types';
7
8
// Mock ComposioClient
9
const mockClient = {
@@ -71,7 +69,7 @@ describe('ConnectionRequest', () => {
69
is_disabled: false,
70
},
71
state: {
74
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
72
+ authScheme: AuthSchemeTypes.OAUTH2,
73
val: {
74
status: 'ACTIVE',
75
access_token: 'access_token_123',
ts/packages/core/test/models/toolkits.test.ts
+1
-2
@@ -5,7 +5,6 @@ import { telemetry } from '../../src/telemetry/Telemetry';
5
import { ComposioAuthConfigNotFoundError } from '../../src/errors/AuthConfigErrors';
6
import { AuthSchemeTypes } from '../../src/types/authConfigs.types';
7
import { ConnectionRequest } from '../../src/models/ConnectionRequest';
8
-import { ConnectedAccountAuthSchemes } from '../../src/types/connectedAccounts.types';
8
9
// Mock dependencies
10
vi.mock('../../src/telemetry/Telemetry', () => ({
@@ -389,7 +388,7 @@ describe('Toolkits', () => {
388
id: 'conn_123',
389
connectionData: {
390
val: {
392
- authScheme: ConnectedAccountAuthSchemes.OAUTH2,
391
+ authScheme: AuthSchemeTypes.OAUTH2,
392
status: 'INITIALIZING',
393
redirectUrl: 'https://auth.example.com/connect',
394
},
ts/packages/core/test/tools/tools.test.ts
+60
-8
@@ -67,8 +67,6 @@ describe('Tools', () => {
67
expect(mockClient.tools.list).toHaveBeenCalledWith({
68
tool_slugs: 'TOOL1,TOOL2',
69
limit: '9999',
70
- cursor: undefined,
71
- important: undefined,
70
search: undefined,
71
toolkit_slug: undefined,
72
});
@@ -79,7 +77,6 @@ describe('Tools', () => {
77
const query = {
78
toolkits: ['github'],
79
limit: 10,
82
- important: true,
80
};
81
82
mockClient.tools.list.mockResolvedValueOnce({
@@ -93,8 +90,6 @@ describe('Tools', () => {
90
tool_slugs: undefined,
91
toolkit_slug: 'github',
92
limit: '10',
96
- cursor: undefined,
97
- important: 'true',
93
search: undefined,
94
});
95
});
@@ -105,7 +100,6 @@ describe('Tools', () => {
100
toolkits: ['github'],
101
search: 'test',
102
limit: 10,
108
- cursor: 'next-page',
103
};
104
105
mockClient.tools.list.mockResolvedValueOnce({
@@ -119,12 +113,70 @@ describe('Tools', () => {
113
tool_slugs: undefined,
114
toolkit_slug: 'github',
115
limit: '10',
122
- cursor: 'next-page',
123
- important: undefined,
116
search: 'test',
117
});
118
});
119
120
+ it('should handle toolkit scopes parameters correctly', async () => {
121
+ const userId = 'test-user';
122
+ const query = {
123
+ toolkits: ['todoist'],
124
+ scopes: ['task:add', 'task:read'],
125
+ limit: 10,
126
+ };
127
+
128
+ mockClient.tools.list.mockResolvedValueOnce({
129
+ items: [toolMocks.rawTool],
130
+ totalPages: 1,
131
+ });
132
+
133
+ await context.tools.getRawComposioTools(query);
134
+
135
+ expect(mockClient.tools.list).toHaveBeenCalledWith({
136
+ tool_slugs: undefined,
137
+ toolkit_slug: 'todoist',
138
+ limit: '10',
139
+ search: undefined,
140
+ scopes: ['task:add', 'task:read'],
141
+ });
142
+ });
143
+
144
+ it('should handle toolkit scopes with search parameters correctly', async () => {
145
+ const userId = 'test-user';
146
+ const query = {
147
+ toolkits: ['todoist'],
148
+ scopes: ['task:add'],
149
+ search: 'add task',
150
+ limit: 10,
151
+ };
152
+
153
+ mockClient.tools.list.mockResolvedValueOnce({
154
+ items: [toolMocks.rawTool],
155
+ totalPages: 1,
156
+ });
157
+
158
+ await context.tools.getRawComposioTools(query);
159
+
160
+ expect(mockClient.tools.list).toHaveBeenCalledWith({
161
+ tool_slugs: undefined,
162
+ toolkit_slug: 'todoist',
163
+ limit: '10',
164
+ search: 'add task',
165
+ scopes: ['task:add'],
166
+ });
167
+ });
168
+
169
+ it('should throw a validation error when scopes are provided without toolkits', async () => {
170
+ const userId = 'test-user';
171
+ const invalidQuery = {
172
+ scopes: ['task:add'],
173
+ } as any;
174
+
175
+ await expect(context.tools.getRawComposioTools(invalidQuery)).rejects.toThrow(
176
+ 'Invalid tool list parameters'
177
+ );
178
+ });
179
+
180
it('should transform tool case correctly', async () => {
181
const userId = 'test-user';
182