Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: auto-generate TypeScript SDK reference

haxzie26e7d6bcaa0e
diff --git a/docs/content/reference/sdk-reference/typescript/composio.mdx b/docs/content/reference/sdk-reference/typescript/composio.mdx
index 4726c9131..d667976bd 100644
--- a/docs/content/reference/sdk-reference/typescript/composio.mdx
+++ b/docs/content/reference/sdk-reference/typescript/composio.mdx
@@ -61,7 +61,7 @@ const composio = new Composio({
| `toolRouter` | `ToolRouter` | Experimental feature, use with caution |
| `tools` | `Tools` | List, retrieve, and execute tools |
| `triggers` | `Triggers` | Manage webhook triggers and event subscriptions |
-| `use` | `(id: string) => Promise<ToolRouterSession>` | Use an existing tool router session |
+| `use` | `(id: string) => Promise<Session>` | Use an existing tool router session |
## Methods
diff --git a/docs/content/reference/sdk-reference/typescript/index.mdx b/docs/content/reference/sdk-reference/typescript/index.mdx
index bb1a60701..f878725a2 100644
--- a/docs/content/reference/sdk-reference/typescript/index.mdx
+++ b/docs/content/reference/sdk-reference/typescript/index.mdx
@@ -36,7 +36,10 @@ bun add @composio/core
| [`AuthConfigs`](/reference/sdk-reference/typescript/auth-configs) | AuthConfigs class |
| [`ConnectedAccounts`](/reference/sdk-reference/typescript/connected-accounts) | ConnectedAccounts class |
| [`MCP`](/reference/sdk-reference/typescript/mcp) | MCP (Model Control Protocol) class |
+| [`RemoteFile`](/reference/sdk-reference/typescript/remote-file) | Represents a file stored in a tool router session's file mount. |
| [`Toolkits`](/reference/sdk-reference/typescript/toolkits) | Toolkits class |
+| [`ToolRouterSession`](/reference/sdk-reference/typescript/tool-router-session) | ToolRouterSession API |
+| [`ToolRouterSessionFilesMount`](/reference/sdk-reference/typescript/tool-router-session-files-mount) | ToolRouterSessionFilesMount API |
| [`Tools`](/reference/sdk-reference/typescript/tools) | This class is used to manage tools in the Composio SDK. |
| [`Triggers`](/reference/sdk-reference/typescript/triggers) | Trigger (Instance) class |
diff --git a/docs/content/reference/sdk-reference/typescript/meta.json b/docs/content/reference/sdk-reference/typescript/meta.json
index 0ba43a906..ed7f17d9d 100644
--- a/docs/content/reference/sdk-reference/typescript/meta.json
+++ b/docs/content/reference/sdk-reference/typescript/meta.json
@@ -5,7 +5,10 @@
"auth-configs",
"connected-accounts",
"mcp",
+ "remote-file",
"toolkits",
+ "tool-router-session",
+ "tool-router-session-files-mount",
"tools",
"triggers"
]
diff --git a/docs/content/reference/sdk-reference/typescript/remote-file.mdx b/docs/content/reference/sdk-reference/typescript/remote-file.mdx
new file mode 100644
index 000000000..e8df8cc7f
--- /dev/null
+++ b/docs/content/reference/sdk-reference/typescript/remote-file.mdx
@@ -0,0 +1,107 @@
+---
+title: RemoteFile
+description: Represents a file stored in a tool router session's file mount. Provides methods to fetch, save, and work with the file content.
+---
+
+## Usage
+
+Access this class through the `composio.remoteFile` property:
+
+```typescript
+const composio = new Composio({ apiKey: 'your-api-key' });
+const result = await composio.remoteFile.list();
+```
+
+## Properties
+
+| Name | Type | Description |
+|------|------|-------------|
+| `downloadUrl` | `string` | Presigned URL for downloading the file |
+| `expiresAt` | `string` | ISO 8601 timestamp when the download URL expires |
+| `mountRelativePath` | `string` | Relative path within the mount (e.g. "report.pdf") |
+| `sandboxMountPrefix` | `string` | Absolute mount path inside the sandbox (e.g. /mnt/files) |
+
+## Methods
+
+### blob()
+
+Fetches the file content as a Blob.
+
+```typescript
+async blob(): Promise<Blob>
+```
+
+**Returns**
+
+`Promise<Blob>` — The file content as a Blob
+
+---
+
+### buffer()
+
+Fetches the file content as a buffer.
+
+```typescript
+async buffer(): Promise<Uint8Array<ArrayBufferLike>>
+```
+
+**Returns**
+
+`Promise<Uint8Array<ArrayBufferLike>>` — The file content as a Uint8Array
+
+---
+
+### save()
+
+Downloads and saves the file to the local filesystem.
+Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
+
+```typescript
+async save(path?: string): Promise<string>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `path?` | `string` | Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path. |
+
+**Returns**
+
+`Promise<string>` — The absolute path where the file was saved
+
+---
+
+### text()
+
+Fetches the file content as UTF-8 text.
+
+```typescript
+async text(): Promise<string>
+```
+
+**Returns**
+
+`Promise<string>` — The file content as a string
+
+---
+
+### parse()
+
+Parses an API response (snake_case) and returns a RemoteFile instance.
+
+```typescript
+parse(data: unknown): RemoteFile
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `data` | `unknown` | Raw API response with snake_case keys |
+
+**Returns**
+
+`RemoteFile` — A RemoteFile instance
+
+---
diff --git a/docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx b/docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx
new file mode 100644
index 000000000..e93d3f50b
--- /dev/null
+++ b/docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx
@@ -0,0 +1,172 @@
+---
+title: ToolRouterSessionFilesMount
+description: ToolRouterSessionFilesMount class reference
+---
+
+## Usage
+
+Access this class through the `composio.toolRouterSessionFilesMount` property:
+
+```typescript
+const composio = new Composio({ apiKey: 'your-api-key' });
+const result = await composio.toolRouterSessionFilesMount.list();
+```
+
+## Methods
+
+### delete()
+
+Deletes a file or directory at the specified path on the session's file mount.
+
+Removes the file or directory from the virtual filesystem. Use with caution:
+deletion is typically irreversible. Ensure the path exists and is intended for removal.
+
+```typescript
+async delete(remotePath: string, options?: { mountId?: string }): Promise<{ mountRelativePath: string; sandboxMountPrefix: string }>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `remotePath` | `string` | The path of the file or directory to delete on the mount. |
+| `options?` | `object` | Optional configuration for the delete operation. |
+
+**Returns**
+
+`Promise<...>` — Confirmation of deletion (implementation-specific).
+
+**Example**
+
+```typescript
+const session = await composio.toolRouter.use('session_123');
+await session.files.delete('/temp/cache.json');
+```
+
+```typescript
+// Delete from a custom mount
+await session.files.delete('/old-backup', {
+ mountId: 'custom-mount',
+});
+```
+
+---
+
+### download()
+
+Downloads a file from the session's file mount to the local filesystem.
+
+Retrieves a file stored in the session's virtual filesystem (e.g., one produced
+by a tool or previously uploaded) and saves it to the specified local path.
+
+```typescript
+async download(filePath: string, options?: { mountId?: string }): Promise<RemoteFile>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `filePath` | `string` | The path of the file on the mount to download, or the local path where the file should be saved (implementation-specific). |
+| `options?` | `object` | Optional configuration for the download. |
+
+**Returns**
+
+`Promise<RemoteFile>` — The downloaded file data or path (implementation-specific).
+
+**Example**
+
+```typescript
+const session = await composio.toolRouter.use('session_123');
+const result = await session.files.download('/output/report.pdf');
+```
+
+```typescript
+// Download from a custom mount
+await session.files.download('/exports/data.json', {
+ mountId: 'custom-mount',
+});
+```
+
+---
+
+### list()
+
+Lists files and directories at the specified path on the session's file mount.
+
+Use this to browse the virtual filesystem attached to the tool router session.
+The path is relative to the mount root (e.g., `"/"` for root, `"/documents"` for a subdirectory).
+Supports cursor-based pagination via `cursor` and `limit` options.
+
+```typescript
+async list(options?: { cursor?: string; limit?: number; mountId?: string; path?: string }): Promise<...>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `options?` | `object` | Optional configuration for the list operation. |
+
+**Returns**
+
+`Promise<...>` — List of files with nextCursor for pagination.
+
+**Example**
+
+```typescript
+const session = await composio.toolRouter.use('session_123');
+const { items, nextCursor } = await session.files.list({ path: '/' });
+```
+
+```typescript
+// Paginated listing
+let result = await session.files.list({ path: '/', limit: 10 });
+while (result.nextCursor) {
+ result = await session.files.list({ path: '/', cursor: result.nextCursor, limit: 10 });
+}
+```
+
+---
+
+### upload()
+
+Uploads a file to the session's file mount.
+
+Accepts a file path (local or URL), a native File object, or a raw buffer.
+The file is stored in the virtual filesystem associated with the tool router session.
+
+```typescript
+async upload(input: string | File | ArrayBuffer | Uint8Array<ArrayBufferLike>, options?: { mimetype?: string; mountId?: string; remotePath?: string }): Promise<RemoteFile>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `input` | `string | File | ArrayBuffer | Uint8Array<ArrayBufferLike>` | File path (string), native File, or raw buffer (ArrayBuffer | Uint8Array). |
+| `options?` | `object` | Optional configuration. When passing a buffer, remotePath is required. |
+
+**Returns**
+
+`Promise<RemoteFile>` — Metadata about the uploaded file.
+
+**Example**
+
+```typescript
+// From file path (local or URL)
+await session.files.upload('/path/to/report.pdf');
+await session.files.upload('https://example.com/file.pdf');
+```
+
+```typescript
+// From native File (e.g. from input[type=file])
+await session.files.upload(fileInput.files[0]);
+```
+
+```typescript
+// From raw buffer
+await session.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
+```
+
+---
diff --git a/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx b/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx
new file mode 100644
index 000000000..c35b78e1c
--- /dev/null
+++ b/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx
@@ -0,0 +1,156 @@
+---
+title: ToolRouterSession
+description: ToolRouterSession class reference
+---
+
+## Usage
+
+Access this class through the `composio.toolRouterSession` property:
+
+```typescript
+const composio = new Composio({ apiKey: 'your-api-key' });
+const result = await composio.toolRouterSession.list();
+```
+
+## Properties
+
+| Name | Type |
+|------|------|
+| `experimental` | `SessionExperimental` |
+| `files` | `ToolRouterSessionFilesMount` |
+| `mcp` | `object` |
+| `sessionId` | `string` |
+
+## Methods
+
+### authorize()
+
+Initiate an authorization flow for a toolkit.
+Returns a ConnectionRequest with a redirect URL for the user.
+
+```typescript
+async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<ConnectionRequest>
+```
+
+**Parameters**
+
+| Name | Type |
+|------|------|
+| `toolkit` | `string` |
+| `options?` | `object` |
+
+**Returns**
+
+`Promise<ConnectionRequest>`
+
+---
+
+### execute()
+
+Execute a tool within the session.
+
+```typescript
+async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `toolSlug` | `string` | The tool slug to execute (e.g. "GMAIL_SEND_EMAIL") |
+| `arguments_?` | `Record<string, unknown>` | Optional tool arguments. Defaults to empty object if omitted. |
+
+**Returns**
+
+`Promise<...>` — The tool execution result
+
+**Example**
+
+```typescript
+const session = await composio.toolRouter.use('session_123');
+const result = await session.execute('GMAIL_SEND_EMAIL', {
+ subject: 'Hello',
+ body: 'Hi!',
+});
+```
+
+```typescript
+// Execute with no arguments
+const result = await session.execute('HACKERNEWS_GET_USER');
+```
+
+---
+
+### search()
+
+Search for tools by semantic use case.
+Returns relevant tools for the given query with schemas and guidance.
+
+```typescript
+async search(params: { query: string; toolkits?: string[] }): Promise<...>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `params` | `object` | Search parameters |
+
+**Returns**
+
+`Promise<...>` — Search results with matching tools and schemas
+
+**Example**
+
+```typescript
+const session = await composio.toolRouter.use('session_123');
+const results = await session.search({
+ query: 'send emails and notify Slack',
+ toolkits: ['gmail', 'slack'],
+});
+```
+
+---
+
+### toolkits()
+
+Query the connection state of toolkits in the session.
+Supports pagination and filtering by toolkit slugs.
+
+```typescript
+async toolkits(options?: { isConnected?: boolean; limit?: number; nextCursor?: string; search?: string; toolkits?: string[] }): Promise<...>
+```
+
+**Parameters**
+
+| Name | Type |
+|------|------|
+| `options?` | `object` |
+
+**Returns**
+
+`Promise<...>`
+
+---
+
+### tools()
+
+Get the tools available in the session, formatted for your AI framework.
+Requires a provider to be configured in the Composio constructor.
+
+```typescript
+async tools(modifiers?: SessionMetaToolOptions): Promise<ReturnType>
+```
+
+**Parameters**
+
+| Name | Type |
+|------|------|
+| `modifiers?` | `SessionMetaToolOptions` |
+
+**Returns**
+
+`Promise<ReturnType>`
+
+---