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: correct usage examples for nested classes in SDK reference
RemoteFile, ToolRouterSession, and ToolRouterSessionFilesMount aren't top-level composio.* properties. Add CLASS_CUSTOM_USAGE map to the generator so future regenerations produce correct access patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmitha Mallesh committed
Mar 11, 2026 at 00:22 UTC
7e924fb97d19063707f84dd712aff5cd2750da7b
4 files changed
+66
-18
docs/content/reference/sdk-reference/typescript/remote-file.mdx
+5
-2
@@ -5,11 +5,14 @@ description: Represents a file stored in a tool router session's file mount. Pro
5
6
## Usage
7
8
-Access this class through the `composio.remoteFile` property:
8
+`RemoteFile` is returned by session file operations such as `session.files.download()` and `session.files.upload()`:
9
10
```typescript
11
const composio = new Composio({ apiKey: 'your-api-key' });
12
-const result = await composio.remoteFile.list();
12
+const session = await composio.toolRouter.use('session_123');
13
+const file = await session.files.download('/output/report.pdf');
14
+// file is a RemoteFile instance
15
+const content = await file.text();
16
```
17
18
## Properties
docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx
+3
-2
@@ -5,11 +5,12 @@ description: ToolRouterSessionFilesMount class reference
5
6
## Usage
7
8
-Access this class through the `composio.toolRouterSessionFilesMount` property:
8
+Access via the `files` property on a session:
9
10
```typescript
11
const composio = new Composio({ apiKey: 'your-api-key' });
12
-const result = await composio.toolRouterSessionFilesMount.list();
12
+const session = await composio.toolRouter.use('session_123');
13
+const { items } = await session.files.list({ path: '/' });
14
```
15
16
## Methods
docs/content/reference/sdk-reference/typescript/tool-router-session.mdx
+7
-2
@@ -5,11 +5,16 @@ description: ToolRouterSession class reference
5
6
## Usage
7
8
-Access this class through the `composio.toolRouterSession` property:
8
+Obtain a session via `composio.toolRouter`:
9
10
```typescript
11
const composio = new Composio({ apiKey: 'your-api-key' });
12
-const result = await composio.toolRouterSession.list();
12
+
13
+// Use an existing session
14
+const session = await composio.toolRouter.use('session_123');
15
+
16
+// Or create a new session
17
+const session = await composio.toolRouter.create('user_123', { toolkits: ['github'] });
18
```
19
20
## Properties
ts/packages/core/scripts/generate-docs.ts
+51
-12
@@ -31,6 +31,35 @@ const INTERNAL_CLASSES = new Set([
31
// Classes that users instantiate directly (show constructor)
32
const USER_INSTANTIATED_CLASSES = new Set(['Composio']);
33
34
+// Custom usage examples for classes that aren't top-level composio.* properties
35
+const CLASS_CUSTOM_USAGE: Record<string, { intro: string; code: string }> = {
36
+ RemoteFile: {
37
+ intro:
38
+ '`RemoteFile` is returned by session file operations such as `session.files.download()` and `session.files.upload()`:',
39
+ code: `const composio = new Composio({ apiKey: 'your-api-key' });
40
+const session = await composio.toolRouter.use('session_123');
41
+const file = await session.files.download('/output/report.pdf');
42
+// file is a RemoteFile instance
43
+const content = await file.text();`,
44
+ },
45
+ ToolRouterSession: {
46
+ intro: 'Obtain a session via `composio.toolRouter`:',
47
+ code: `const composio = new Composio({ apiKey: 'your-api-key' });
48
+
49
+// Use an existing session
50
+const session = await composio.toolRouter.use('session_123');
51
+
52
+// Or create a new session
53
+const session = await composio.toolRouter.create('user_123', { toolkits: ['github'] });`,
54
+ },
55
+ ToolRouterSessionFilesMount: {
56
+ intro: 'Access via the `files` property on a session:',
57
+ code: `const composio = new Composio({ apiKey: 'your-api-key' });
58
+const session = await composio.toolRouter.use('session_123');
59
+const { items } = await session.files.list({ path: '/' });`,
60
+ },
61
+};
62
+
63
// Discover model files automatically
64
async function discoverModelFiles(): Promise<string[]> {
65
const files = await readdir(MODELS_DIR);
@@ -538,20 +567,30 @@ function generateClassMdx(classDoc: ClassDoc): string {
567
lines.push('');
568
lines.push(generateMethodMdx(classDoc.constructor));
569
} else if (!USER_INSTANTIATED_CLASSES.has(classDoc.name)) {
541
- // Show usage hint for non-instantiated classes
542
- // Handle acronyms (e.g., "MCP" -> "mcp") vs PascalCase (e.g., "AuthConfigs" -> "authConfigs")
543
- const accessorName =
544
- classDoc.name === classDoc.name.toUpperCase()
545
- ? classDoc.name.toLowerCase()
546
- : classDoc.name.charAt(0).toLowerCase() + classDoc.name.slice(1);
570
lines.push('## Usage');
571
lines.push('');
549
- lines.push(`Access this class through the \`composio.${accessorName}\` property:`);
550
- lines.push('');
551
- lines.push('```typescript');
552
- lines.push(`const composio = new Composio({ apiKey: 'your-api-key' });`);
553
- lines.push(`const result = await composio.${accessorName}.list();`);
554
- lines.push('```');
572
+
573
+ const customUsage = CLASS_CUSTOM_USAGE[classDoc.name];
574
+ if (customUsage) {
575
+ lines.push(customUsage.intro);
576
+ lines.push('');
577
+ lines.push('```typescript');
578
+ lines.push(customUsage.code);
579
+ lines.push('```');
580
+ } else {
581
+ // Default: show as top-level composio.* property
582
+ // Handle acronyms (e.g., "MCP" -> "mcp") vs PascalCase (e.g., "AuthConfigs" -> "authConfigs")
583
+ const accessorName =
584
+ classDoc.name === classDoc.name.toUpperCase()
585
+ ? classDoc.name.toLowerCase()
586
+ : classDoc.name.charAt(0).toLowerCase() + classDoc.name.slice(1);
587
+ lines.push(`Access this class through the \`composio.${accessorName}\` property:`);
588
+ lines.push('');
589
+ lines.push('```typescript');
590
+ lines.push(`const composio = new Composio({ apiKey: 'your-api-key' });`);
591
+ lines.push(`const result = await composio.${accessorName}.list();`);
592
+ lines.push('```');
593
+ }
594
lines.push('');
595
}
596