Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 03:15 UTC
docs: auto-generate TypeScript SDK reference
haxzie committed
Mar 10, 2026 at 07:46 UTC
26e7d6bcaa0e506f4f87ff2baa1998cc191b3cab
6 files changed
+442
-1
docs/content/reference/sdk-reference/typescript/composio.mdx
+1
-1
@@ -61,7 +61,7 @@ const composio = new Composio({
61
| `toolRouter` | `ToolRouter` | Experimental feature, use with caution |
62
| `tools` | `Tools` | List, retrieve, and execute tools |
63
| `triggers` | `Triggers` | Manage webhook triggers and event subscriptions |
64
-| `use` | `(id: string) => Promise<ToolRouterSession>` | Use an existing tool router session |
64
+| `use` | `(id: string) => Promise<Session>` | Use an existing tool router session |
65
66
## Methods
67
docs/content/reference/sdk-reference/typescript/index.mdx
+3
@@ -36,7 +36,10 @@ bun add @composio/core
36
| [`AuthConfigs`](/reference/sdk-reference/typescript/auth-configs) | AuthConfigs class |
37
| [`ConnectedAccounts`](/reference/sdk-reference/typescript/connected-accounts) | ConnectedAccounts class |
38
| [`MCP`](/reference/sdk-reference/typescript/mcp) | MCP (Model Control Protocol) class |
39
+| [`RemoteFile`](/reference/sdk-reference/typescript/remote-file) | Represents a file stored in a tool router session's file mount. |
40
| [`Toolkits`](/reference/sdk-reference/typescript/toolkits) | Toolkits class |
41
+| [`ToolRouterSession`](/reference/sdk-reference/typescript/tool-router-session) | ToolRouterSession API |
42
+| [`ToolRouterSessionFilesMount`](/reference/sdk-reference/typescript/tool-router-session-files-mount) | ToolRouterSessionFilesMount API |
43
| [`Tools`](/reference/sdk-reference/typescript/tools) | This class is used to manage tools in the Composio SDK. |
44
| [`Triggers`](/reference/sdk-reference/typescript/triggers) | Trigger (Instance) class |
45
docs/content/reference/sdk-reference/typescript/meta.json
+3
@@ -5,7 +5,10 @@
5
"auth-configs",
6
"connected-accounts",
7
"mcp",
8
+ "remote-file",
9
"toolkits",
10
+ "tool-router-session",
11
+ "tool-router-session-files-mount",
12
"tools",
13
"triggers"
14
]
docs/content/reference/sdk-reference/typescript/remote-file.mdx
new
+107
@@ -0,0 +1,107 @@
1
+---
2
+title: RemoteFile
3
+description: Represents a file stored in a tool router session's file mount. Provides methods to fetch, save, and work with the file content.
4
+---
5
+
6
+## Usage
7
+
8
+Access this class through the `composio.remoteFile` property:
9
+
10
+```typescript
11
+const composio = new Composio({ apiKey: 'your-api-key' });
12
+const result = await composio.remoteFile.list();
13
+```
14
+
15
+## Properties
16
+
17
+| Name | Type | Description |
18
+|------|------|-------------|
19
+| `downloadUrl` | `string` | Presigned URL for downloading the file |
20
+| `expiresAt` | `string` | ISO 8601 timestamp when the download URL expires |
21
+| `mountRelativePath` | `string` | Relative path within the mount (e.g. "report.pdf") |
22
+| `sandboxMountPrefix` | `string` | Absolute mount path inside the sandbox (e.g. /mnt/files) |
23
+
24
+## Methods
25
+
26
+### blob()
27
+
28
+Fetches the file content as a Blob.
29
+
30
+```typescript
31
+async blob(): Promise<Blob>
32
+```
33
+
34
+**Returns**
35
+
36
+`Promise<Blob>` — The file content as a Blob
37
+
38
+---
39
+
40
+### buffer()
41
+
42
+Fetches the file content as a buffer.
43
+
44
+```typescript
45
+async buffer(): Promise<Uint8Array<ArrayBufferLike>>
46
+```
47
+
48
+**Returns**
49
+
50
+`Promise<Uint8Array<ArrayBufferLike>>` — The file content as a Uint8Array
51
+
52
+---
53
+
54
+### save()
55
+
56
+Downloads and saves the file to the local filesystem.
57
+Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
58
+
59
+```typescript
60
+async save(path?: string): Promise<string>
61
+```
62
+
63
+**Parameters**
64
+
65
+| Name | Type | Description |
66
+|------|------|-------------|
67
+| `path?` | `string` | Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path. |
68
+
69
+**Returns**
70
+
71
+`Promise<string>` — The absolute path where the file was saved
72
+
73
+---
74
+
75
+### text()
76
+
77
+Fetches the file content as UTF-8 text.
78
+
79
+```typescript
80
+async text(): Promise<string>
81
+```
82
+
83
+**Returns**
84
+
85
+`Promise<string>` — The file content as a string
86
+
87
+---
88
+
89
+### parse()
90
+
91
+Parses an API response (snake_case) and returns a RemoteFile instance.
92
+
93
+```typescript
94
+parse(data: unknown): RemoteFile
95
+```
96
+
97
+**Parameters**
98
+
99
+| Name | Type | Description |
100
+|------|------|-------------|
101
+| `data` | `unknown` | Raw API response with snake_case keys |
102
+
103
+**Returns**
104
+
105
+`RemoteFile` — A RemoteFile instance
106
+
107
+---
docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx
new
+172
@@ -0,0 +1,172 @@
1
+---
2
+title: ToolRouterSessionFilesMount
3
+description: ToolRouterSessionFilesMount class reference
4
+---
5
+
6
+## Usage
7
+
8
+Access this class through the `composio.toolRouterSessionFilesMount` property:
9
+
10
+```typescript
11
+const composio = new Composio({ apiKey: 'your-api-key' });
12
+const result = await composio.toolRouterSessionFilesMount.list();
13
+```
14
+
15
+## Methods
16
+
17
+### delete()
18
+
19
+Deletes a file or directory at the specified path on the session's file mount.
20
+
21
+Removes the file or directory from the virtual filesystem. Use with caution:
22
+deletion is typically irreversible. Ensure the path exists and is intended for removal.
23
+
24
+```typescript
25
+async delete(remotePath: string, options?: { mountId?: string }): Promise<{ mountRelativePath: string; sandboxMountPrefix: string }>
26
+```
27
+
28
+**Parameters**
29
+
30
+| Name | Type | Description |
31
+|------|------|-------------|
32
+| `remotePath` | `string` | The path of the file or directory to delete on the mount. |
33
+| `options?` | `object` | Optional configuration for the delete operation. |
34
+
35
+**Returns**
36
+
37
+`Promise<...>` — Confirmation of deletion (implementation-specific).
38
+
39
+**Example**
40
+
41
+```typescript
42
+const session = await composio.toolRouter.use('session_123');
43
+await session.files.delete('/temp/cache.json');
44
+```
45
+
46
+```typescript
47
+// Delete from a custom mount
48
+await session.files.delete('/old-backup', {
49
+ mountId: 'custom-mount',
50
+});
51
+```
52
+
53
+---
54
+
55
+### download()
56
+
57
+Downloads a file from the session's file mount to the local filesystem.
58
+
59
+Retrieves a file stored in the session's virtual filesystem (e.g., one produced
60
+by a tool or previously uploaded) and saves it to the specified local path.
61
+
62
+```typescript
63
+async download(filePath: string, options?: { mountId?: string }): Promise<RemoteFile>
64
+```
65
+
66
+**Parameters**
67
+
68
+| Name | Type | Description |
69
+|------|------|-------------|
70
+| `filePath` | `string` | The path of the file on the mount to download, or the local path where the file should be saved (implementation-specific). |
71
+| `options?` | `object` | Optional configuration for the download. |
72
+
73
+**Returns**
74
+
75
+`Promise<RemoteFile>` — The downloaded file data or path (implementation-specific).
76
+
77
+**Example**
78
+
79
+```typescript
80
+const session = await composio.toolRouter.use('session_123');
81
+const result = await session.files.download('/output/report.pdf');
82
+```
83
+
84
+```typescript
85
+// Download from a custom mount
86
+await session.files.download('/exports/data.json', {
87
+ mountId: 'custom-mount',
88
+});
89
+```
90
+
91
+---
92
+
93
+### list()
94
+
95
+Lists files and directories at the specified path on the session's file mount.
96
+
97
+Use this to browse the virtual filesystem attached to the tool router session.
98
+The path is relative to the mount root (e.g., `"/"` for root, `"/documents"` for a subdirectory).
99
+Supports cursor-based pagination via `cursor` and `limit` options.
100
+
101
+```typescript
102
+async list(options?: { cursor?: string; limit?: number; mountId?: string; path?: string }): Promise<...>
103
+```
104
+
105
+**Parameters**
106
+
107
+| Name | Type | Description |
108
+|------|------|-------------|
109
+| `options?` | `object` | Optional configuration for the list operation. |
110
+
111
+**Returns**
112
+
113
+`Promise<...>` — List of files with nextCursor for pagination.
114
+
115
+**Example**
116
+
117
+```typescript
118
+const session = await composio.toolRouter.use('session_123');
119
+const { items, nextCursor } = await session.files.list({ path: '/' });
120
+```
121
+
122
+```typescript
123
+// Paginated listing
124
+let result = await session.files.list({ path: '/', limit: 10 });
125
+while (result.nextCursor) {
126
+ result = await session.files.list({ path: '/', cursor: result.nextCursor, limit: 10 });
127
+}
128
+```
129
+
130
+---
131
+
132
+### upload()
133
+
134
+Uploads a file to the session's file mount.
135
+
136
+Accepts a file path (local or URL), a native File object, or a raw buffer.
137
+The file is stored in the virtual filesystem associated with the tool router session.
138
+
139
+```typescript
140
+async upload(input: string | File | ArrayBuffer | Uint8Array<ArrayBufferLike>, options?: { mimetype?: string; mountId?: string; remotePath?: string }): Promise<RemoteFile>
141
+```
142
+
143
+**Parameters**
144
+
145
+| Name | Type | Description |
146
+|------|------|-------------|
147
+| `input` | `string | File | ArrayBuffer | Uint8Array<ArrayBufferLike>` | File path (string), native File, or raw buffer (ArrayBuffer | Uint8Array). |
148
+| `options?` | `object` | Optional configuration. When passing a buffer, remotePath is required. |
149
+
150
+**Returns**
151
+
152
+`Promise<RemoteFile>` — Metadata about the uploaded file.
153
+
154
+**Example**
155
+
156
+```typescript
157
+// From file path (local or URL)
158
+await session.files.upload('/path/to/report.pdf');
159
+await session.files.upload('https://example.com/file.pdf');
160
+```
161
+
162
+```typescript
163
+// From native File (e.g. from input[type=file])
164
+await session.files.upload(fileInput.files[0]);
165
+```
166
+
167
+```typescript
168
+// From raw buffer
169
+await session.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
170
+```
171
+
172
+---
docs/content/reference/sdk-reference/typescript/tool-router-session.mdx
new
+156
@@ -0,0 +1,156 @@
1
+---
2
+title: ToolRouterSession
3
+description: ToolRouterSession class reference
4
+---
5
+
6
+## Usage
7
+
8
+Access this class through the `composio.toolRouterSession` property:
9
+
10
+```typescript
11
+const composio = new Composio({ apiKey: 'your-api-key' });
12
+const result = await composio.toolRouterSession.list();
13
+```
14
+
15
+## Properties
16
+
17
+| Name | Type |
18
+|------|------|
19
+| `experimental` | `SessionExperimental` |
20
+| `files` | `ToolRouterSessionFilesMount` |
21
+| `mcp` | `object` |
22
+| `sessionId` | `string` |
23
+
24
+## Methods
25
+
26
+### authorize()
27
+
28
+Initiate an authorization flow for a toolkit.
29
+Returns a ConnectionRequest with a redirect URL for the user.
30
+
31
+```typescript
32
+async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<ConnectionRequest>
33
+```
34
+
35
+**Parameters**
36
+
37
+| Name | Type |
38
+|------|------|
39
+| `toolkit` | `string` |
40
+| `options?` | `object` |
41
+
42
+**Returns**
43
+
44
+`Promise<ConnectionRequest>`
45
+
46
+---
47
+
48
+### execute()
49
+
50
+Execute a tool within the session.
51
+
52
+```typescript
53
+async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>
54
+```
55
+
56
+**Parameters**
57
+
58
+| Name | Type | Description |
59
+|------|------|-------------|
60
+| `toolSlug` | `string` | The tool slug to execute (e.g. "GMAIL_SEND_EMAIL") |
61
+| `arguments_?` | `Record<string, unknown>` | Optional tool arguments. Defaults to empty object if omitted. |
62
+
63
+**Returns**
64
+
65
+`Promise<...>` — The tool execution result
66
+
67
+**Example**
68
+
69
+```typescript
70
+const session = await composio.toolRouter.use('session_123');
71
+const result = await session.execute('GMAIL_SEND_EMAIL', {
72
+ to: 'user@example.com',
73
+ subject: 'Hello',
74
+ body: 'Hi!',
75
+});
76
+```
77
+
78
+```typescript
79
+// Execute with no arguments
80
+const result = await session.execute('HACKERNEWS_GET_USER');
81
+```
82
+
83
+---
84
+
85
+### search()
86
+
87
+Search for tools by semantic use case.
88
+Returns relevant tools for the given query with schemas and guidance.
89
+
90
+```typescript
91
+async search(params: { query: string; toolkits?: string[] }): Promise<...>
92
+```
93
+
94
+**Parameters**
95
+
96
+| Name | Type | Description |
97
+|------|------|-------------|
98
+| `params` | `object` | Search parameters |
99
+
100
+**Returns**
101
+
102
+`Promise<...>` — Search results with matching tools and schemas
103
+
104
+**Example**
105
+
106
+```typescript
107
+const session = await composio.toolRouter.use('session_123');
108
+const results = await session.search({
109
+ query: 'send emails and notify Slack',
110
+ toolkits: ['gmail', 'slack'],
111
+});
112
+```
113
+
114
+---
115
+
116
+### toolkits()
117
+
118
+Query the connection state of toolkits in the session.
119
+Supports pagination and filtering by toolkit slugs.
120
+
121
+```typescript
122
+async toolkits(options?: { isConnected?: boolean; limit?: number; nextCursor?: string; search?: string; toolkits?: string[] }): Promise<...>
123
+```
124
+
125
+**Parameters**
126
+
127
+| Name | Type |
128
+|------|------|
129
+| `options?` | `object` |
130
+
131
+**Returns**
132
+
133
+`Promise<...>`
134
+
135
+---
136
+
137
+### tools()
138
+
139
+Get the tools available in the session, formatted for your AI framework.
140
+Requires a provider to be configured in the Composio constructor.
141
+
142
+```typescript
143
+async tools(modifiers?: SessionMetaToolOptions): Promise<ReturnType>
144
+```
145
+
146
+**Parameters**
147
+
148
+| Name | Type |
149
+|------|------|
150
+| `modifiers?` | `SessionMetaToolOptions` |
151
+
152
+**Returns**
153
+
154
+`Promise<ReturnType>`
155
+
156
+---