@composio/core 0.18.1 → 0.20.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.
- package/dist/{CustomTool-VRfWzMix.d.mts → CustomTool-B3m-188G.d.mts} +1 -1
- package/dist/{CustomTool-Bz0f52QR.mjs → CustomTool-fYEFjSLM.mjs} +1 -1
- package/dist/{FileModifierErrors-CwB-Inm9.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
- package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
- package/dist/{SsrfErrors-xhdVE4yw.mjs → SsrfErrors-DiQldIdC.mjs} +32 -17
- package/dist/{Telemetry-Dw9W5RSp.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
- package/dist/{cancellation-P5YUlcfz.mjs → cancellation-Dwa9lGHA.mjs} +7 -5
- package/dist/{composio-Cb3d1jFe.d.mts → composio-B36OXii1.d.mts} +3017 -144
- package/dist/{customTool.types-B6ej_8XZ.d.mts → customTool.types-C436M_D0.d.mts} +525 -101
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +8 -15
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +101 -18
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +123 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +9 -2
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +7 -0
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +56 -0
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +15 -15
- package/dist/docs/reference/sdk-reference/typescript/meta.json +8 -1
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +117 -24
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +24 -10
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +151 -14
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +50 -40
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +26 -25
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +162 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +218 -0
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +20 -0
- package/dist/{errors-Ue9wMrPK.mjs → errors-D_A4b2c2.mjs} +143 -4
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-KE5Fa-af.mjs → fileUtils.node-DNLhLg0W.mjs} +8 -6
- package/dist/index.d.mts +418 -146
- package/dist/index.mjs +2728 -349
- package/dist/models/Files.node.d.mts +2 -3
- package/dist/models/Files.node.mjs +2 -2
- package/dist/models/Files.workerd.d.mts +2 -3
- package/dist/platform/node.d.mts +2 -3
- package/dist/platform/workerd.d.mts +2 -3
- package/dist/{sensitiveFileUploadPaths-QN7w4n8v.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +10 -7
- package/dist/{ssrfGuard.node-BLX6b-Rf.mjs → ssrfGuard.node-BZ270bcu.mjs} +104 -14
- package/dist/{types-CGdgK442.d.mts → types-Br3GBya5.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +19 -10
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +12 -4
- package/dist/utils/ssrfGuard.workerd.mjs +2 -2
- package/package.json +9 -9
- package/src/composio.ts +207 -10
- package/src/errors/ConnectedAccountsErrors.ts +47 -0
- package/src/errors/SDKErrors.ts +52 -0
- package/src/errors/ToolErrors.ts +24 -0
- package/src/errors/ToolRouterErrors.ts +57 -0
- package/src/errors/index.ts +3 -0
- package/src/index.ts +15 -0
- package/src/lib/toolRouterMcp.ts +132 -0
- package/src/lib/toolRouterParams.ts +116 -29
- package/src/models/ConnectedAccounts.ts +118 -2
- package/src/models/CustomToolkits.ts +169 -0
- package/src/models/Experimental.ts +27 -0
- package/src/models/Keyring.ts +65 -0
- package/src/models/Logs.ts +101 -0
- package/src/models/MCP.ts +29 -15
- package/src/models/ToolRouter.ts +43 -14
- package/src/models/ToolRouterSession.ts +224 -16
- package/src/models/Toolkits.ts +181 -2
- package/src/models/Tools.ts +58 -26
- package/src/models/Triggers.ts +10 -90
- package/src/models/Usage.ts +119 -0
- package/src/models/Webhooks.ts +520 -0
- package/src/services/pusher/Pusher.ts +46 -16
- package/src/types/authConfigs.types.ts +2 -0
- package/src/types/connectedAccounts.types.ts +54 -0
- package/src/types/customToolkits.types.ts +102 -0
- package/src/types/keyring.types.ts +32 -0
- package/src/types/logs.types.ts +108 -0
- package/src/types/toolRouter.types.ts +259 -14
- package/src/types/toolkit.types.ts +161 -0
- package/src/types/usage.types.ts +81 -0
- package/src/types/webhooks.types.ts +143 -0
- package/src/utils/constants.ts +1 -5
- package/src/utils/jsonSchema.ts +4 -1
- package/src/utils/logger.ts +39 -7
- package/src/utils/sdk.ts +385 -22
- package/src/utils/ssrfGuard.node.ts +127 -13
- package/src/utils/ssrfGuard.workerd.ts +11 -1
- package/src/utils/transformers/connectedAccounts.ts +37 -2
- package/src/utils/transformers/customToolkits.ts +98 -0
- package/src/utils/transformers/keyring.ts +24 -0
- package/src/utils/transformers/logs.ts +85 -0
- package/src/utils/transformers/toolkits.ts +183 -3
- package/src/utils/transformers/triggers.ts +2 -2
- package/src/utils/transformers/usage.ts +77 -0
- package/src/utils/transformers/webhooks.ts +139 -0
|
@@ -20,10 +20,17 @@ Creates a new tool router session for a user.
|
|
|
20
20
|
Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
|
|
21
21
|
should be exposed directly; see `ToolRouterCreateSessionConfig`.
|
|
22
22
|
|
|
23
|
+
The session's MCP config carries the session credential only when the
|
|
24
|
+
MCP URL shares the origin of the configured API base URL. When it does
|
|
25
|
+
not, `mcp: true` makes the call throw `ComposioMCPDestinationError`
|
|
26
|
+
(naming both origins, never a key); without `mcp: true` the session is
|
|
27
|
+
returned with `session.mcp.headers` empty and a warning naming both
|
|
28
|
+
origins is logged, so native tools keep working.
|
|
29
|
+
|
|
23
30
|
**Overload 1**
|
|
24
31
|
|
|
25
32
|
```typescript
|
|
26
|
-
async create(userId: string, config:
|
|
33
|
+
async create(userId: string, config: { authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string | string[]>; experimental?: { assistivePrompt?: { userTimezone?: string }; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] }; manageConnections?: boolean | { callbackUrl?: string; enable?: boolean; waitForConnections?: boolean }; mcp?: boolean; multiAccount?: { enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean }; preload?: { tools?: string[] | 'all' }; sandbox?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' }; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] | { disable?: ... | ... | ... | ...[]; enable?: ... | ... | ... | ...[] }; toolkits?: string[] | { disable: string[] } | { enable: string[] }; tools?: Record<string, string[] | { enable: ...[] } | { disable: ...[] } | { tags: ... | ... }>; workbench?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } } & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
**Parameters**
|
|
@@ -31,7 +38,7 @@ async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true
|
|
|
31
38
|
| Name | Type | Description |
|
|
32
39
|
|------|------|-------------|
|
|
33
40
|
| `userId` | `string` | \{string\} The user id to create the session for |
|
|
34
|
-
| `config` |
|
|
41
|
+
| `config` | `\{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| string[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: string[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \| \{ disable?: ... \| ... \| ... \| ...[]; enable?: ... \| ... \| ... \| ...[] \}; toolkits?: string[] \| \{ disable: string[] \} \| \{ enable: string[] \}; tools?: Record<string, string[] \| \{ enable: ...[] \} \| \{ disable: ...[] \} \| \{ tags: ... \| ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
|
|
35
42
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
36
43
|
|
|
37
44
|
**Returns**
|
|
@@ -41,7 +48,7 @@ async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true
|
|
|
41
48
|
**Overload 2**
|
|
42
49
|
|
|
43
50
|
```typescript
|
|
44
|
-
async create(userId: string, config?:
|
|
51
|
+
async create(userId: string, config?: { authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string | string[]>; experimental?: { assistivePrompt?: { userTimezone?: string }; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] }; manageConnections?: boolean | { callbackUrl?: string; enable?: boolean; waitForConnections?: boolean }; mcp?: boolean; multiAccount?: { enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean }; preload?: { tools?: string[] | 'all' }; sandbox?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' }; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] | { disable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[]; enable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] }; toolkits?: string[] | { disable: string[] } | { enable: string[] }; tools?: Record<string, string[] | { enable: string[] } | { disable: string[] } | { tags: ...[] | { disable?: ...; enable?: ... } }>; workbench?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
45
52
|
```
|
|
46
53
|
|
|
47
54
|
**Parameters**
|
|
@@ -49,7 +56,7 @@ async create(userId: string, config?: ToolRouterCreateSessionConfig, requestOpti
|
|
|
49
56
|
| Name | Type | Description |
|
|
50
57
|
|------|------|-------------|
|
|
51
58
|
| `userId` | `string` | \{string\} The user id to create the session for |
|
|
52
|
-
| `config?` | `
|
|
59
|
+
| `config?` | `\{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| string[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: string[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \| \{ disable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[]; enable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \}; toolkits?: string[] \| \{ disable: string[] \} \| \{ enable: string[] \}; tools?: Record<string, string[] \| \{ enable: string[] \} \| \{ disable: string[] \} \| \{ tags: ...[] \| \{ disable?: ...; enable?: ... \} \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
|
|
53
60
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
54
61
|
|
|
55
62
|
**Returns**
|
|
@@ -83,7 +90,7 @@ Deleted sessions immediately stop being retrievable or executable. Deleting
|
|
|
83
90
|
a missing or already-deleted session surfaces the backend 404.
|
|
84
91
|
|
|
85
92
|
```typescript
|
|
86
|
-
async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<
|
|
93
|
+
async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<{ deleted: true; sessionId: string }>
|
|
87
94
|
```
|
|
88
95
|
|
|
89
96
|
**Parameters**
|
|
@@ -95,7 +102,7 @@ async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<ToolR
|
|
|
95
102
|
|
|
96
103
|
**Returns**
|
|
97
104
|
|
|
98
|
-
`Promise
|
|
105
|
+
`Promise<\{ deleted: true; sessionId: string \}>`
|
|
99
106
|
|
|
100
107
|
---
|
|
101
108
|
|
|
@@ -103,10 +110,17 @@ async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<ToolR
|
|
|
103
110
|
|
|
104
111
|
Use an existing session
|
|
105
112
|
|
|
113
|
+
The session's MCP config carries the session credential only when the
|
|
114
|
+
MCP URL shares the origin of the configured API base URL. When it does
|
|
115
|
+
not, `mcp: true` makes the call throw `ComposioMCPDestinationError`
|
|
116
|
+
(naming both origins, never a key); without `mcp: true` the session is
|
|
117
|
+
returned with `session.mcp.headers` empty and a warning naming both
|
|
118
|
+
origins is logged, so native tools keep working.
|
|
119
|
+
|
|
106
120
|
**Overload 1**
|
|
107
121
|
|
|
108
122
|
```typescript
|
|
109
|
-
async use(id: string, options: {
|
|
123
|
+
async use(id: string, options: { customToolkits?: CustomToolkit[]; customTools?: CustomTool[]; mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
110
124
|
```
|
|
111
125
|
|
|
112
126
|
**Parameters**
|
|
@@ -114,7 +128,7 @@ async use(id: string, options: { customTools?: CustomTool[]; customToolkits?: Cu
|
|
|
114
128
|
| Name | Type | Description |
|
|
115
129
|
|------|------|-------------|
|
|
116
130
|
| `id` | `string` | \{string\} The id of the session to use |
|
|
117
|
-
| `options` | `\{
|
|
131
|
+
| `options` | `\{ customToolkits?: CustomToolkit[]; customTools?: CustomTool[]; mcp: true \}` | |
|
|
118
132
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
119
133
|
|
|
120
134
|
**Returns**
|
|
@@ -124,7 +138,7 @@ async use(id: string, options: { customTools?: CustomTool[]; customToolkits?: Cu
|
|
|
124
138
|
**Overload 2**
|
|
125
139
|
|
|
126
140
|
```typescript
|
|
127
|
-
async use(id: string, options?: {
|
|
141
|
+
async use(id: string, options?: { customToolkits?: CustomToolkit[]; customTools?: CustomTool[]; mcp?: boolean }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
128
142
|
```
|
|
129
143
|
|
|
130
144
|
**Parameters**
|
|
@@ -132,7 +146,7 @@ async use(id: string, options?: { customTools?: CustomTool[]; customToolkits?: C
|
|
|
132
146
|
| Name | Type | Description |
|
|
133
147
|
|------|------|-------------|
|
|
134
148
|
| `id` | `string` | \{string\} The id of the session to use |
|
|
135
|
-
| `options?` | `\{
|
|
149
|
+
| `options?` | `\{ customToolkits?: CustomToolkit[]; customTools?: CustomTool[]; mcp?: boolean \}` | |
|
|
136
150
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
137
151
|
|
|
138
152
|
**Returns**
|
|
@@ -9,7 +9,7 @@ Access this class through the `composio.toolkits` property:
|
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
11
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const result = await composio.toolkits.
|
|
12
|
+
const result = await composio.toolkits.get({});
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
@@ -44,6 +44,35 @@ const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
|
+
### changelog()
|
|
48
|
+
|
|
49
|
+
Retrieves the version changelog of every toolkit (the last 10 versions
|
|
50
|
+
per toolkit).
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
async changelog(requestOptions?: ComposioRequestOptions): Promise<{ items: { displayName: string; name: string; slug: string; versions: { changelog: ...; version: ... }[] }[] }>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Parameters**
|
|
57
|
+
|
|
58
|
+
| Name | Type |
|
|
59
|
+
|------|------|
|
|
60
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
61
|
+
|
|
62
|
+
**Returns**
|
|
63
|
+
|
|
64
|
+
`Promise<\{ items: \{ displayName: string; name: string; slug: string; versions: \{ changelog: ...; version: ... \}[] \}[] \}>` — Toolkits with their recent version changelogs
|
|
65
|
+
|
|
66
|
+
**Example**
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const { items } = await composio.toolkits.changelog();
|
|
70
|
+
const github = items.find(item => item.slug === 'github');
|
|
71
|
+
console.log(github?.versions[0]); // { version: '20250909_00', changelog: '...' }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
47
76
|
### get()
|
|
48
77
|
|
|
49
78
|
Retrieves a specific toolkit by its slug identifier.
|
|
@@ -51,7 +80,7 @@ Retrieves a specific toolkit by its slug identifier.
|
|
|
51
80
|
**Overload 1**
|
|
52
81
|
|
|
53
82
|
```typescript
|
|
54
|
-
async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<
|
|
83
|
+
async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<{ authConfigDetails?: { authHintUrl?: string | null; fields: { authConfigCreation: { optional: ...; required: ... }; connectedAccountInitiation: { optional: ...; required: ... } }; mode: string; name: string; proxy?: { baseUrl?: string }; requiredScopes?: string[] }[]; baseUrl?: string; composioManagedAuthSchemes?: string[]; getCurrentUserEndpoint?: string; getCurrentUserEndpointMethod?: string; isLocalToolkit: boolean; meta: { appUrl?: string; availableVersions?: string[]; categories?: { name: string; slug: string }[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string }; name: string; slug: string }>
|
|
55
84
|
```
|
|
56
85
|
|
|
57
86
|
**Parameters**
|
|
@@ -63,24 +92,24 @@ async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<Toolki
|
|
|
63
92
|
|
|
64
93
|
**Returns**
|
|
65
94
|
|
|
66
|
-
`Promise
|
|
95
|
+
`Promise<\{ authConfigDetails?: \{ authHintUrl?: string \| null; fields: \{ authConfigCreation: \{ optional: ...; required: ... \}; connectedAccountInitiation: \{ optional: ...; required: ... \} \}; mode: string; name: string; proxy?: \{ baseUrl?: string \}; requiredScopes?: string[] \}[]; baseUrl?: string; composioManagedAuthSchemes?: string[]; getCurrentUserEndpoint?: string; getCurrentUserEndpointMethod?: string; isLocalToolkit: boolean; meta: \{ appUrl?: string; availableVersions?: string[]; categories?: \{ name: string; slug: string \}[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string \}; name: string; slug: string \}>` — The toolkit object with detailed information
|
|
67
96
|
|
|
68
97
|
**Overload 2**
|
|
69
98
|
|
|
70
99
|
```typescript
|
|
71
|
-
async get(query?:
|
|
100
|
+
async get(query?: { category?: string; cursor?: string; limit?: number; managedBy?: 'all' | 'composio' | 'project'; sortBy?: 'usage' | 'alphabetically' }, requestOptions?: ComposioRequestOptions): Promise<{ authSchemes?: string[]; composioManagedAuthSchemes?: string[]; isLocalToolkit: boolean; meta: { appUrl?: string; availableVersions?: string[]; categories?: { name: ...; slug: ... }[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string }; name: string; noAuth?: boolean; slug: string }[]>
|
|
72
101
|
```
|
|
73
102
|
|
|
74
103
|
**Parameters**
|
|
75
104
|
|
|
76
105
|
| Name | Type | Description |
|
|
77
106
|
|------|------|-------------|
|
|
78
|
-
| `query?` | `
|
|
107
|
+
| `query?` | `\{ category?: string; cursor?: string; limit?: number; managedBy?: 'all' \| 'composio' \| 'project'; sortBy?: 'usage' \| 'alphabetically' \}` | The query parameters to filter toolkits |
|
|
79
108
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
80
109
|
|
|
81
110
|
**Returns**
|
|
82
111
|
|
|
83
|
-
`Promise
|
|
112
|
+
`Promise<\{ authSchemes?: string[]; composioManagedAuthSchemes?: string[]; isLocalToolkit: boolean; meta: \{ appUrl?: string; availableVersions?: string[]; categories?: \{ name: ...; slug: ... \}[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string \}; name: string; noAuth?: boolean; slug: string \}[]>` — A paginated list of toolkits matching the query criteria
|
|
84
113
|
|
|
85
114
|
**Example**
|
|
86
115
|
|
|
@@ -98,7 +127,7 @@ console.log(githubToolkit.authConfigDetails); // Authentication configuration de
|
|
|
98
127
|
Retrieves the fields required for creating an auth config for a toolkit.
|
|
99
128
|
|
|
100
129
|
```typescript
|
|
101
|
-
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options
|
|
130
|
+
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<...>
|
|
102
131
|
```
|
|
103
132
|
|
|
104
133
|
**Parameters**
|
|
@@ -107,11 +136,11 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
|
|
|
107
136
|
|------|------|-------------|
|
|
108
137
|
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
109
138
|
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
110
|
-
| `options
|
|
139
|
+
| `options?` | `\{ requiredOnly?: boolean \}` | |
|
|
111
140
|
|
|
112
141
|
**Returns**
|
|
113
142
|
|
|
114
|
-
`Promise
|
|
143
|
+
`Promise<...>` — The fields required for creating an auth config
|
|
115
144
|
|
|
116
145
|
---
|
|
117
146
|
|
|
@@ -120,7 +149,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
|
|
|
120
149
|
Retrieves the fields required for initiating a connected account for a toolkit.
|
|
121
150
|
|
|
122
151
|
```typescript
|
|
123
|
-
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options
|
|
152
|
+
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<...>
|
|
124
153
|
```
|
|
125
154
|
|
|
126
155
|
**Parameters**
|
|
@@ -129,11 +158,43 @@ async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthS
|
|
|
129
158
|
|------|------|-------------|
|
|
130
159
|
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
131
160
|
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
132
|
-
| `options
|
|
161
|
+
| `options?` | `\{ requiredOnly?: boolean \}` | |
|
|
162
|
+
|
|
163
|
+
**Returns**
|
|
164
|
+
|
|
165
|
+
`Promise<...>` — The fields required for initiating a connected account
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### getMany()
|
|
170
|
+
|
|
171
|
+
Retrieves several toolkits by slug in a single request.
|
|
172
|
+
|
|
173
|
+
Returns the same transformed shape as `composio.toolkits.get({ ... })`.
|
|
174
|
+
Unknown slugs are simply absent from the result.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
async getMany(slugs: string[], params?: { category?: string; cursor?: string; limit?: number; managedBy?: 'all' | 'composio' | 'project'; sortBy?: 'usage' | 'alphabetically' }, requestOptions?: ComposioRequestOptions): Promise<{ authSchemes?: string[]; composioManagedAuthSchemes?: string[]; isLocalToolkit: boolean; meta: { appUrl?: string; availableVersions?: string[]; categories?: { name: ...; slug: ... }[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string }; name: string; noAuth?: boolean; slug: string }[]>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Parameters**
|
|
181
|
+
|
|
182
|
+
| Name | Type | Description |
|
|
183
|
+
|------|------|-------------|
|
|
184
|
+
| `slugs` | `string[]` | The toolkit slugs to retrieve (at least one) |
|
|
185
|
+
| `params?` | `\{ category?: string; cursor?: string; limit?: number; managedBy?: 'all' \| 'composio' \| 'project'; sortBy?: 'usage' \| 'alphabetically' \}` | Optional filters and pagination, as for `list` |
|
|
186
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
133
187
|
|
|
134
188
|
**Returns**
|
|
135
189
|
|
|
136
|
-
`Promise
|
|
190
|
+
`Promise<\{ authSchemes?: string[]; composioManagedAuthSchemes?: string[]; isLocalToolkit: boolean; meta: \{ appUrl?: string; availableVersions?: string[]; categories?: \{ name: ...; slug: ... \}[]; createdAt?: string; description?: string; logo?: string; toolsCount?: number; triggersCount?: number; updatedAt?: string \}; name: string; noAuth?: boolean; slug: string \}[]>` — The matching toolkits
|
|
191
|
+
|
|
192
|
+
**Example**
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const toolkits = await composio.toolkits.getMany(['github', 'slack']);
|
|
196
|
+
console.log(toolkits.map(toolkit => toolkit.name)); // ['GitHub', 'Slack']
|
|
197
|
+
```
|
|
137
198
|
|
|
138
199
|
---
|
|
139
200
|
|
|
@@ -145,7 +206,7 @@ This method fetches the complete list of categories from the Composio API
|
|
|
145
206
|
and transforms the response to use camelCase property naming.
|
|
146
207
|
|
|
147
208
|
```typescript
|
|
148
|
-
async listCategories(requestOptions?: ComposioRequestOptions): Promise<
|
|
209
|
+
async listCategories(requestOptions?: ComposioRequestOptions): Promise<{ items: { id: string; name: string }[]; nextCursor: string | null; totalPages: number }>
|
|
149
210
|
```
|
|
150
211
|
|
|
151
212
|
**Parameters**
|
|
@@ -156,7 +217,7 @@ async listCategories(requestOptions?: ComposioRequestOptions): Promise<ToolkitRe
|
|
|
156
217
|
|
|
157
218
|
**Returns**
|
|
158
219
|
|
|
159
|
-
`Promise
|
|
220
|
+
`Promise<\{ items: \{ id: string; name: string \}[]; nextCursor: string \| null; totalPages: number \}>` — The list of toolkit categories
|
|
160
221
|
|
|
161
222
|
**Example**
|
|
162
223
|
|
|
@@ -167,3 +228,79 @@ console.log(categories.items); // Array of category objects
|
|
|
167
228
|
```
|
|
168
229
|
|
|
169
230
|
---
|
|
231
|
+
|
|
232
|
+
### listGrantContexts()
|
|
233
|
+
|
|
234
|
+
Lists the grant-context dimensions a toolkit's scope recommendation
|
|
235
|
+
depends on (for example the Google account type), with their allowed
|
|
236
|
+
values and the default the API assumes.
|
|
237
|
+
**Experimental — the API marks this endpoint beta; shape may change.**
|
|
238
|
+
|
|
239
|
+
Pass a dimension and a value as `grantContext` to
|
|
240
|
+
`composio.toolkits.recommendScopes()` to tailor the recommendation.
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
async listGrantContexts(toolkitSlug: string, params?: { authScheme?: 'OAUTH2' | 'OAUTH1' | 'API_KEY' | 'BASIC' | 'BILLCOM_AUTH' | 'BEARER_TOKEN' | 'GOOGLE_SERVICE_ACCOUNT' | 'NO_AUTH' | 'BASIC_WITH_JWT' | 'CALCOM_AUTH' | 'SERVICE_ACCOUNT' | 'SAML' | 'DCR_OAUTH' | 'CIMD_OAUTH' | 'S2S_OAUTH2'; toolkitVersion?: string }, requestOptions?: ComposioRequestOptions): Promise<{ authScheme: string; defaultGrantContext: Record<string, string>; grantContextDimensions: { description: string; dimension: string; values: string[] }[]; toolkitVersion: string }>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Parameters**
|
|
247
|
+
|
|
248
|
+
| Name | Type | Description |
|
|
249
|
+
|------|------|-------------|
|
|
250
|
+
| `toolkitSlug` | `string` | The toolkit to list grant contexts for |
|
|
251
|
+
| `params?` | `\{ authScheme?: 'OAUTH2' \| 'OAUTH1' \| 'API_KEY' \| 'BASIC' \| 'BILLCOM_AUTH' \| 'BEARER_TOKEN' \| 'GOOGLE_SERVICE_ACCOUNT' \| 'NO_AUTH' \| 'BASIC_WITH_JWT' \| 'CALCOM_AUTH' \| 'SERVICE_ACCOUNT' \| 'SAML' \| 'DCR_OAUTH' \| 'CIMD_OAUTH' \| 'S2S_OAUTH2'; toolkitVersion?: string \}` | Optional auth scheme and toolkit version |
|
|
252
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
253
|
+
|
|
254
|
+
**Returns**
|
|
255
|
+
|
|
256
|
+
`Promise<\{ authScheme: string; defaultGrantContext: Record<string, string>; grantContextDimensions: \{ description: string; dimension: string; values: string[] \}[]; toolkitVersion: string \}>` — The dimensions and the default grant context
|
|
257
|
+
|
|
258
|
+
**Example**
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
const { grantContextDimensions } = await composio.toolkits.listGrantContexts('gmail');
|
|
262
|
+
const [accountType] = grantContextDimensions;
|
|
263
|
+
const { scopes } = await composio.toolkits.recommendScopes('gmail', {
|
|
264
|
+
tools: ['GMAIL_SEND_EMAIL'],
|
|
265
|
+
grantContext: { [accountType.dimension]: accountType.values[0] },
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### recommendScopes()
|
|
272
|
+
|
|
273
|
+
Recommends the OAuth scopes to request so a connection can run the given
|
|
274
|
+
tools.
|
|
275
|
+
**Experimental — the API marks this endpoint beta; shape may change.**
|
|
276
|
+
|
|
277
|
+
The answer comes in two variants: `leastPrivilege` (narrowest documented
|
|
278
|
+
scope per requirement) and `fewest` (smallest set covering everything).
|
|
279
|
+
Pass `toolkitVersion` from a previous answer to pin the computation.
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
async recommendScopes(toolkitSlug: string, params: { authScheme?: 'OAUTH2' | 'OAUTH1' | 'API_KEY' | 'BASIC' | 'BILLCOM_AUTH' | 'BEARER_TOKEN' | 'GOOGLE_SERVICE_ACCOUNT' | 'NO_AUTH' | 'BASIC_WITH_JWT' | 'CALCOM_AUTH' | 'SERVICE_ACCOUNT' | 'SAML' | 'DCR_OAUTH' | 'CIMD_OAUTH' | 'S2S_OAUTH2'; availableScopes?: string[]; exclude?: string[]; grantContext?: Record<string, string>; include?: string[]; toolkitVersion?: string; tools: string[] }, requestOptions?: ComposioRequestOptions): Promise<{ authScheme: string; grantContext: Record<string, string>; scopes: { conditional: { for: ...[]; scope: string; when: Record<..., ...> }[]; fewest: string[]; leastPrivilege: string[] }; toolkitVersion: string }>
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Parameters**
|
|
286
|
+
|
|
287
|
+
| Name | Type | Description |
|
|
288
|
+
|------|------|-------------|
|
|
289
|
+
| `toolkitSlug` | `string` | The toolkit to recommend scopes for |
|
|
290
|
+
| `params` | `\{ authScheme?: 'OAUTH2' \| 'OAUTH1' \| 'API_KEY' \| 'BASIC' \| 'BILLCOM_AUTH' \| 'BEARER_TOKEN' \| 'GOOGLE_SERVICE_ACCOUNT' \| 'NO_AUTH' \| 'BASIC_WITH_JWT' \| 'CALCOM_AUTH' \| 'SERVICE_ACCOUNT' \| 'SAML' \| 'DCR_OAUTH' \| 'CIMD_OAUTH' \| 'S2S_OAUTH2'; availableScopes?: string[]; exclude?: string[]; grantContext?: Record<string, string>; include?: string[]; toolkitVersion?: string; tools: string[] \}` | Tools to cover (`[]` for the whole toolkit), auth scheme, grant context and scope constraints |
|
|
291
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
292
|
+
|
|
293
|
+
**Returns**
|
|
294
|
+
|
|
295
|
+
`Promise<\{ authScheme: string; grantContext: Record<string, string>; scopes: \{ conditional: \{ for: ...[]; scope: string; when: Record<..., ...> \}[]; fewest: string[]; leastPrivilege: string[] \}; toolkitVersion: string \}>` — The recommended scope sets
|
|
296
|
+
|
|
297
|
+
**Example**
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
const { scopes } = await composio.toolkits.recommendScopes('gmail', {
|
|
301
|
+
tools: ['GMAIL_SEND_EMAIL', 'GMAIL_FETCH_EMAILS'],
|
|
302
|
+
});
|
|
303
|
+
console.log(scopes.leastPrivilege);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|