@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.
- package/dist/BaseProvider-Brb3o86-.d.mts +29425 -0
- package/dist/{CustomTool-DEB4BQPl.mjs → CustomTool-D9qwyMrv.mjs} +1 -1
- package/dist/{CustomTool-DH18rVQu.d.mts → CustomTool-Dmi6ti3I.d.mts} +1 -1
- package/dist/CustomTool-DrJpOhY2.d.mts +74 -0
- package/dist/{composio-CHnEggnv.d.mts → composio-DHIKRdeG.d.mts} +253 -37
- package/dist/composio-vMwhASRc.d.mts +5698 -0
- package/dist/{customTool.types-DpIdOJjL.d.mts → customTool.types-CKH2R2ia.d.mts} +344 -25
- package/dist/customTool.types-DXin7Cfc.d.mts +2773 -0
- package/dist/docs/error-consistency.md +97 -0
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
- package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
- package/dist/{errors-D5f4pfvI.mjs → errors-DSIlYfl5.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.d.mts +27 -4
- package/dist/index.mjs +423 -123
- package/dist/{jsonSchema-daqF3S3d.mjs → jsonSchema-CFKdONpP.mjs} +1 -1
- package/dist/{types-CaI5Z4PA.d.mts → types-D4Id3wXA.d.mts} +1 -1
- package/dist/types-qTbYYBJw.d.mts +12 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
- package/docs/error-consistency.md +97 -0
- package/package.json +4 -3
- package/src/composio.ts +509 -0
- package/src/errors/AuthConfigErrors.ts +23 -0
- package/src/errors/ComposioError.ts +408 -0
- package/src/errors/ConnectedAccountsErrors.ts +158 -0
- package/src/errors/ConnectionRequestErrors.ts +32 -0
- package/src/errors/FileModifierErrors.ts +100 -0
- package/src/errors/PusherErrors.ts +28 -0
- package/src/errors/RemoteFileErrors.ts +62 -0
- package/src/errors/SDKErrors.ts +92 -0
- package/src/errors/ToolErrors.ts +244 -0
- package/src/errors/ToolkitErrors.ts +39 -0
- package/src/errors/TriggerErrors.ts +120 -0
- package/src/errors/ValidationErrors.ts +99 -0
- package/src/errors/index.ts +41 -0
- package/src/experimental/index.ts +28 -0
- package/src/index.ts +64 -0
- package/src/lib/toolRouterConstants.ts +1 -0
- package/src/lib/toolRouterParams.ts +306 -0
- package/src/models/AuthConfigs.ts +398 -0
- package/src/models/AuthScheme.ts +206 -0
- package/src/models/ConnectedAccounts.ts +735 -0
- package/src/models/ConnectionRequest.ts +150 -0
- package/src/models/CustomTool.ts +676 -0
- package/src/models/Experimental.ts +202 -0
- package/src/models/Files.node.ts +93 -0
- package/src/models/Files.workerd.ts +49 -0
- package/src/models/MCP.ts +478 -0
- package/src/models/RemoteFile.ts +172 -0
- package/src/models/SessionContext.ts +147 -0
- package/src/models/Sessions.ts +21 -0
- package/src/models/ToolRouter.ts +391 -0
- package/src/models/ToolRouterSession.ts +827 -0
- package/src/models/ToolRouterSessionFileMount.ts +389 -0
- package/src/models/Toolkits.ts +412 -0
- package/src/models/Tools.ts +1260 -0
- package/src/models/Triggers.ts +1381 -0
- package/src/models/customToolExecution.ts +118 -0
- package/src/models/inlineCustomToolsPayload.ts +17 -0
- package/src/models/proxyParamsTransform.ts +26 -0
- package/src/provider/BaseProvider.ts +138 -0
- package/src/provider/ComposioProvider.ts +29 -0
- package/src/provider/OpenAIProvider.ts +547 -0
- package/src/services/internal/InternalService.ts +50 -0
- package/src/services/internal/InternalService.types.ts +14 -0
- package/src/services/pusher/Pusher.ts +230 -0
- package/src/services/telemetry/TelemetryService.ts +48 -0
- package/src/services/telemetry/TelemetryService.types.ts +67 -0
- package/src/telemetry/BatchProcessor.ts +77 -0
- package/src/telemetry/README.md +123 -0
- package/src/telemetry/Telemetry.ts +356 -0
- package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
- package/src/types/authConfigs.types.ts +174 -0
- package/src/types/composio.types.ts +1 -0
- package/src/types/connectedAccountAuthStates.types.ts +852 -0
- package/src/types/connectedAccounts.types.ts +395 -0
- package/src/types/connectionRequest.types.ts +16 -0
- package/src/types/customTool.types.ts +261 -0
- package/src/types/files.types.ts +15 -0
- package/src/types/mcp.experimental.types.ts +163 -0
- package/src/types/mcp.types.ts +362 -0
- package/src/types/modifiers.types.ts +663 -0
- package/src/types/org.types.ts +0 -0
- package/src/types/provider.types.ts +41 -0
- package/src/types/pusher.types.ts +18 -0
- package/src/types/requestOptions.types.ts +62 -0
- package/src/types/telemetry.types.ts +89 -0
- package/src/types/tool.types.ts +408 -0
- package/src/types/toolRouter.types.ts +761 -0
- package/src/types/toolkit.types.ts +130 -0
- package/src/types/triggers.types.ts +401 -0
- package/src/types/webhookEvents.types.ts +219 -0
- package/src/utils/buffer.ts +30 -0
- package/src/utils/cancellation.ts +22 -0
- package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
- package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
- package/src/utils/config-defaults/index.ts +1 -0
- package/src/utils/config-defaults/types.ts +14 -0
- package/src/utils/constants.ts +22 -0
- package/src/utils/crypto.ts +34 -0
- package/src/utils/env.ts +34 -0
- package/src/utils/fileDirs.ts +81 -0
- package/src/utils/fileUtils.node.ts +458 -0
- package/src/utils/json-schema.ts +1 -0
- package/src/utils/jsonSchema.ts +355 -0
- package/src/utils/logger.ts +99 -0
- package/src/utils/mime.ts +75 -0
- package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
- package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
- package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
- package/src/utils/pagination.ts +73 -0
- package/src/utils/pusher.ts +286 -0
- package/src/utils/schemaPropertyKeys.ts +433 -0
- package/src/utils/sdk.ts +110 -0
- package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
- package/src/utils/session.ts +114 -0
- package/src/utils/toolArguments.ts +73 -0
- package/src/utils/toolkitVersion.ts +26 -0
- package/src/utils/transform.ts +42 -0
- package/src/utils/transformers/authConfigs.ts +107 -0
- package/src/utils/transformers/connectedAccounts.ts +119 -0
- package/src/utils/transformers/mcp.ts +164 -0
- package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
- package/src/utils/transformers/toolkits.ts +100 -0
- package/src/utils/transformers/triggers.ts +118 -0
- package/src/utils/uploadDirAllowlist.node.ts +178 -0
- package/src/utils/uuid.ts +7 -0
- package/src/utils/version.ts +58 -0
- package/src/utils/zodSchema.ts +90 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Tools"
|
|
3
|
+
description: "This class is used to manage tools in the Composio SDK. It provides methods to list, get, and execute tools."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.tools` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.tools.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### execute()
|
|
18
|
+
|
|
19
|
+
Executes a given tool with the provided parameters.
|
|
20
|
+
|
|
21
|
+
This method calls the Composio API to execute the tool and returns the response.
|
|
22
|
+
|
|
23
|
+
**Version Control:**
|
|
24
|
+
By default, manual tool execution requires a specific toolkit version. If the version resolves to "latest",
|
|
25
|
+
the execution will throw a `ComposioToolVersionRequiredError` unless `dangerouslySkipVersionCheck` is set to `true`.
|
|
26
|
+
This helps prevent unexpected behavior when new toolkit versions are released.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
async execute(slug: string, body: ToolExecuteParams, options?: ExecuteToolModifiers & ComposioRequestOptions): Promise<ToolExecuteResponse>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Parameters**
|
|
33
|
+
|
|
34
|
+
| Name | Type | Description |
|
|
35
|
+
|------|------|-------------|
|
|
36
|
+
| `slug` | `string` | The slug/ID of the tool to be executed |
|
|
37
|
+
| `body` | `ToolExecuteParams` | The parameters to be passed to the tool |
|
|
38
|
+
| `options?` | `ExecuteToolModifiers & ComposioRequestOptions` | Optional modifiers and request options |
|
|
39
|
+
|
|
40
|
+
**Returns**
|
|
41
|
+
|
|
42
|
+
`Promise<ToolExecuteResponse>` — The response from the tool execution
|
|
43
|
+
|
|
44
|
+
**Example**
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
48
|
+
userId: 'default',
|
|
49
|
+
version: '20250909_00',
|
|
50
|
+
arguments: { owner: 'composio' }
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const result = await composio.tools.execute('HACKERNEWS_GET_USER', {
|
|
56
|
+
userId: 'default',
|
|
57
|
+
arguments: { userId: 'pg' },
|
|
58
|
+
dangerouslySkipVersionCheck: true // Allows execution with "latest" version
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// If toolkitVersions are set during Composio initialization, no need to pass version
|
|
64
|
+
const composio = new Composio({ toolkitVersions: { github: '20250909_00' } });
|
|
65
|
+
const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
66
|
+
userId: 'default',
|
|
67
|
+
arguments: { owner: 'composio' }
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const result = await composio.tools.execute('GITHUB_GET_ISSUES', {
|
|
73
|
+
userId: 'default',
|
|
74
|
+
version: '20250909_00',
|
|
75
|
+
arguments: { owner: 'composio', repo: 'sdk' }
|
|
76
|
+
}, {
|
|
77
|
+
beforeExecute: ({ toolSlug, toolkitSlug, params }) => {
|
|
78
|
+
console.log(`Executing ${toolSlug} from ${toolkitSlug}`);
|
|
79
|
+
return params;
|
|
80
|
+
},
|
|
81
|
+
afterExecute: ({ toolSlug, toolkitSlug, result }) => {
|
|
82
|
+
console.log(`Completed ${toolSlug}`);
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const result = await composio.tools.execute('HACKERNEWS_GET_FRONTPAGE', {
|
|
90
|
+
userId: 'default',
|
|
91
|
+
arguments: {},
|
|
92
|
+
dangerouslySkipVersionCheck: true,
|
|
93
|
+
}, { signal: AbortSignal.timeout(5_000) });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### executeSessionTool()
|
|
99
|
+
|
|
100
|
+
Executes a tool based on a tool router session.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
async executeSessionTool(toolSlug: string, body: ToolExecuteMetaParams, modifiers?: SessionExecuteMetaModifiers, tool?: Tool, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<ToolExecuteResponse>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Parameters**
|
|
107
|
+
|
|
108
|
+
| Name | Type | Description |
|
|
109
|
+
|------|------|-------------|
|
|
110
|
+
| `toolSlug` | `string` | The slug of the tool to execute |
|
|
111
|
+
| `body` | `ToolExecuteMetaParams` | The execution parameters |
|
|
112
|
+
| `modifiers?` | `SessionExecuteMetaModifiers` | The modifiers to apply to the tool |
|
|
113
|
+
| `tool?` | `Tool` | Optional tool schema used to resolve toolkit metadata for modifiers |
|
|
114
|
+
| `options?` | `ToolRouterSessionExecuteOptions` | |
|
|
115
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
116
|
+
|
|
117
|
+
**Returns**
|
|
118
|
+
|
|
119
|
+
`Promise<ToolExecuteResponse>` — The response from the tool execution
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### get()
|
|
124
|
+
|
|
125
|
+
Get a list of tools from Composio based on filters.
|
|
126
|
+
This method fetches the tools from the Composio API and wraps them using the provider.
|
|
127
|
+
|
|
128
|
+
**Overload 1**
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
async get(userId: string, filters: ToolListParams, options?: ProviderOptions & ComposioRequestOptions): Promise<ReturnType<T['wrapTools']>>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Parameters**
|
|
135
|
+
|
|
136
|
+
| Name | Type | Description |
|
|
137
|
+
|------|------|-------------|
|
|
138
|
+
| `userId` | `string` | The user id to get the tools for |
|
|
139
|
+
| `filters` | `ToolListParams` | The filters to apply when fetching tools |
|
|
140
|
+
| `options?` | `ProviderOptions & ComposioRequestOptions` | Provider options, modifiers, and/or AbortSignal |
|
|
141
|
+
|
|
142
|
+
**Returns**
|
|
143
|
+
|
|
144
|
+
`Promise<ReturnType<T['wrapTools']>>` — The wrapped tools collection
|
|
145
|
+
|
|
146
|
+
**Overload 2**
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
async get(userId: string, slug: string, options?: ProviderOptions & ComposioRequestOptions): Promise<ReturnType<T['wrapTools']>>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Parameters**
|
|
153
|
+
|
|
154
|
+
| Name | Type | Description |
|
|
155
|
+
|------|------|-------------|
|
|
156
|
+
| `userId` | `string` | The user id to get the tool for |
|
|
157
|
+
| `slug` | `string` | The slug of the tool to fetch |
|
|
158
|
+
| `options?` | `ProviderOptions & ComposioRequestOptions` | Optional provider options including modifiers and signal |
|
|
159
|
+
|
|
160
|
+
**Returns**
|
|
161
|
+
|
|
162
|
+
`Promise<ReturnType<T['wrapTools']>>` — The wrapped tool
|
|
163
|
+
|
|
164
|
+
**Example**
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// Get tools from the GitHub toolkit
|
|
168
|
+
const tools = await composio.tools.get('default', {
|
|
169
|
+
toolkits: ['github'],
|
|
170
|
+
limit: 10
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// Timeout a slow search after 5s
|
|
174
|
+
const emailTools = await composio.tools.get('default', {
|
|
175
|
+
search: 'send email',
|
|
176
|
+
}, { signal: AbortSignal.timeout(5_000) });
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### getInput()
|
|
182
|
+
|
|
183
|
+
Fetches the input parameters for a given tool.
|
|
184
|
+
|
|
185
|
+
This method is used to get the input parameters for a tool before executing it.
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
async getInput(slug: string, body: ToolGetInputParams, requestOptions?: ComposioRequestOptions): Promise<ToolGetInputResponse>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Parameters**
|
|
192
|
+
|
|
193
|
+
| Name | Type | Description |
|
|
194
|
+
|------|------|-------------|
|
|
195
|
+
| `slug` | `string` | The ID of the tool to find input for |
|
|
196
|
+
| `body` | `ToolGetInputParams` | The parameters to be passed to the tool |
|
|
197
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
198
|
+
|
|
199
|
+
**Returns**
|
|
200
|
+
|
|
201
|
+
`Promise<ToolGetInputResponse>` — The input parameters schema for the specified tool
|
|
202
|
+
|
|
203
|
+
**Example**
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
// Get input parameters for a specific tool
|
|
207
|
+
const inputParams = await composio.tools.getInput('GITHUB_CREATE_ISSUE', {
|
|
208
|
+
userId: 'default'
|
|
209
|
+
});
|
|
210
|
+
console.log(inputParams.schema);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### getRawComposioToolBySlug()
|
|
216
|
+
|
|
217
|
+
Retrieves a specific tool by its slug from the Composio API.
|
|
218
|
+
|
|
219
|
+
This method fetches a single tool in raw format without provider-specific wrapping,
|
|
220
|
+
providing direct access to the tool's schema and metadata. Tool versions are controlled
|
|
221
|
+
at the Composio SDK initialization level through the `toolkitVersions` configuration.
|
|
222
|
+
Local experimental custom tools are session-scoped; attach them when creating or reusing a
|
|
223
|
+
Tool Router session, then use `session.tools()`, `session.customTools()`, or
|
|
224
|
+
`session.execute()`.
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
async getRawComposioToolBySlug(slug: string, options?: ToolRetrievalOptions, requestOptions?: ComposioRequestOptions): Promise<Tool>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Parameters**
|
|
231
|
+
|
|
232
|
+
| Name | Type | Description |
|
|
233
|
+
|------|------|-------------|
|
|
234
|
+
| `slug` | `string` | The unique identifier of the tool (e.g., 'GITHUB_GET_REPOS') |
|
|
235
|
+
| `options?` | `ToolRetrievalOptions` | Optional configuration for tool retrieval |
|
|
236
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
237
|
+
|
|
238
|
+
**Returns**
|
|
239
|
+
|
|
240
|
+
`Promise<Tool>` — The requested tool with its complete schema and metadata
|
|
241
|
+
|
|
242
|
+
**Example**
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// Get a tool by slug
|
|
246
|
+
const tool = await composio.tools.getRawComposioToolBySlug('GITHUB_GET_REPOS');
|
|
247
|
+
console.log(tool.name, tool.description);
|
|
248
|
+
|
|
249
|
+
// Get a tool with schema transformation
|
|
250
|
+
const customizedTool = await composio.tools.getRawComposioToolBySlug(
|
|
251
|
+
'SLACK_SEND_MESSAGE',
|
|
252
|
+
{
|
|
253
|
+
modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
|
|
254
|
+
return {
|
|
255
|
+
...schema,
|
|
256
|
+
description: `Enhanced ${schema.description} with custom modifications`,
|
|
257
|
+
customMetadata: {
|
|
258
|
+
lastModified: new Date().toISOString(),
|
|
259
|
+
toolkit: toolkitSlug
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
// Access tool properties
|
|
267
|
+
const githubTool = await composio.tools.getRawComposioToolBySlug('GITHUB_CREATE_ISSUE');
|
|
268
|
+
console.log({
|
|
269
|
+
slug: githubTool.slug,
|
|
270
|
+
name: githubTool.name,
|
|
271
|
+
toolkit: githubTool.toolkit?.name,
|
|
272
|
+
version: githubTool.version,
|
|
273
|
+
availableVersions: githubTool.availableVersions,
|
|
274
|
+
inputParameters: githubTool.inputParameters
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### getRawComposioTools()
|
|
281
|
+
|
|
282
|
+
Lists Composio API tools available to the SDK.
|
|
283
|
+
|
|
284
|
+
This method fetches remote Composio tools from the API in raw format. The response can be
|
|
285
|
+
filtered and modified as needed. Local experimental custom tools are session-scoped; attach
|
|
286
|
+
them when creating or reusing a Tool Router session, then use `session.tools()`,
|
|
287
|
+
`session.customTools()`, or `session.execute()`.
|
|
288
|
+
It provides access to the underlying tool data without provider-specific wrapping.
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
async getRawComposioTools(query: ToolListParams, options?: SchemaModifierOptions, requestOptions?: ComposioRequestOptions): Promise<ToolList>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Parameters**
|
|
295
|
+
|
|
296
|
+
| Name | Type | Description |
|
|
297
|
+
|------|------|-------------|
|
|
298
|
+
| `query` | `ToolListParams` | Query parameters to filter the tools (required) |
|
|
299
|
+
| `options?` | `SchemaModifierOptions` | Optional configuration for tool retrieval |
|
|
300
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
301
|
+
|
|
302
|
+
**Returns**
|
|
303
|
+
|
|
304
|
+
`Promise<ToolList>` — List of tools matching the query criteria
|
|
305
|
+
|
|
306
|
+
**Example**
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Get tools from specific toolkits
|
|
310
|
+
const githubTools = await composio.tools.getRawComposioTools({
|
|
311
|
+
toolkits: ['github'],
|
|
312
|
+
limit: 10
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Get specific tools by slug
|
|
316
|
+
const specificTools = await composio.tools.getRawComposioTools({
|
|
317
|
+
tools: ['GITHUB_GET_REPOS', 'HACKERNEWS_GET_USER']
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Get tools from specific toolkits
|
|
321
|
+
const githubTools = await composio.tools.getRawComposioTools({
|
|
322
|
+
toolkits: ['github'],
|
|
323
|
+
limit: 10
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Get tools with schema transformation
|
|
327
|
+
const customizedTools = await composio.tools.getRawComposioTools({
|
|
328
|
+
toolkits: ['github'],
|
|
329
|
+
limit: 5
|
|
330
|
+
}, {
|
|
331
|
+
modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
|
|
332
|
+
// Add custom properties to tool schema
|
|
333
|
+
return {
|
|
334
|
+
...schema,
|
|
335
|
+
customProperty: `Modified ${toolSlug} from ${toolkitSlug}`,
|
|
336
|
+
tags: [...(schema.tags || []), 'customized']
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
// Search for tools
|
|
342
|
+
const searchResults = await composio.tools.getRawComposioTools({
|
|
343
|
+
search: 'user management'
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Get tools by authentication config
|
|
347
|
+
const authSpecificTools = await composio.tools.getRawComposioTools({
|
|
348
|
+
authConfigIds: ['auth_config_123']
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### getRawToolRouterSessionTools()
|
|
355
|
+
|
|
356
|
+
Fetches tools exposed by a tool router session.
|
|
357
|
+
This includes helper/meta tools plus any tools preloaded into the session.
|
|
358
|
+
It provides access to the underlying tool data without provider-specific wrapping.
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
async getRawToolRouterSessionTools(sessionId: string, options?: SchemaModifierOptions, requestOptions?: ComposioRequestOptions): Promise<ToolList>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Parameters**
|
|
365
|
+
|
|
366
|
+
| Name | Type | Description |
|
|
367
|
+
|------|------|-------------|
|
|
368
|
+
| `sessionId` | `string` | \{string\} The session id to get tools for |
|
|
369
|
+
| `options?` | `SchemaModifierOptions` | \{SchemaModifierOptions\} Optional configuration for tool retrieval |
|
|
370
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
371
|
+
|
|
372
|
+
**Returns**
|
|
373
|
+
|
|
374
|
+
`Promise<ToolList>` — The list of session tools
|
|
375
|
+
|
|
376
|
+
**Example**
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
const sessionTools = await composio.tools.getRawToolRouterSessionTools('session_123');
|
|
380
|
+
console.log(sessionTools);
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
### getToolsEnum()
|
|
386
|
+
|
|
387
|
+
Fetches the list of all available tools in the Composio SDK.
|
|
388
|
+
|
|
389
|
+
This method is mostly used by the CLI to get the list of tools.
|
|
390
|
+
No filtering is done on the tools, the list is cached in the backend, no further optimization is required.
|
|
391
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
async getToolsEnum(requestOptions?: ComposioRequestOptions): Promise<ToolRetrieveEnumResponse>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Parameters**
|
|
397
|
+
|
|
398
|
+
| Name | Type |
|
|
399
|
+
|------|------|
|
|
400
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
401
|
+
|
|
402
|
+
**Returns**
|
|
403
|
+
|
|
404
|
+
`Promise<ToolRetrieveEnumResponse>` — The complete list of all available tools with their metadata
|
|
405
|
+
|
|
406
|
+
**Example**
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
// Get all available tools as an enum
|
|
410
|
+
const toolsEnum = await composio.tools.getToolsEnum();
|
|
411
|
+
console.log(toolsEnum.items);
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### proxyExecute()
|
|
417
|
+
|
|
418
|
+
Proxies a custom request to a toolkit/integration.
|
|
419
|
+
|
|
420
|
+
This method allows sending custom requests to a specific toolkit or integration
|
|
421
|
+
when you need more flexibility than the standard tool execution methods provide.
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
async proxyExecute(body: ToolProxyParams, requestOptions?: ComposioRequestOptions): Promise<ToolProxyResponse>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Parameters**
|
|
428
|
+
|
|
429
|
+
| Name | Type | Description |
|
|
430
|
+
|------|------|-------------|
|
|
431
|
+
| `body` | `ToolProxyParams` | The parameters for the proxy request including toolkit slug and custom data |
|
|
432
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
433
|
+
|
|
434
|
+
**Returns**
|
|
435
|
+
|
|
436
|
+
`Promise<ToolProxyResponse>` — The response from the proxied request
|
|
437
|
+
|
|
438
|
+
**Example**
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
// Send a custom request to a toolkit
|
|
442
|
+
const response = await composio.tools.proxyExecute({
|
|
443
|
+
toolkitSlug: 'github',
|
|
444
|
+
userId: 'default',
|
|
445
|
+
data: {
|
|
446
|
+
endpoint: '/repos/owner/repo/issues',
|
|
447
|
+
method: 'GET'
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
console.log(response.data);
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
---
|