@devries-cameron20 / composio Mirror · read-only / commits / a648ceff3
Fork 0

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 21, 12:15 UTC

fix(docs): preserve generated parameter metadata

Brendan O'Leary committed Sep 17, 2026 at 12:01 UTC a648ceff3f17bc7068b0412a0d54aada2a904df7
6 files changed +38 -29
docs/content/reference/sdk-reference/typescript/auth-configs.mdx
+2 -2
@@ -19,7 +19,7 @@ const result = await composio.authConfigs.list();
19 Create a new auth config
20
21 ```typescript
22 -async create(toolkit: string, options: CreateAuthConfigParams, requestOptions?: ComposioRequestOptions): Promise<CreateAuthConfigResponse>
22 +async create(toolkit: string, options?: CreateAuthConfigParams, requestOptions?: ComposioRequestOptions): Promise<CreateAuthConfigResponse>
23 ```
24
25 **Parameters**
@@ -27,7 +27,7 @@ async create(toolkit: string, options: CreateAuthConfigParams, requestOptions?:
27 | Name | Type | Description |
28 |------|------|-------------|
29 | `toolkit` | `string` | Unique identifier of the toolkit |
30 -| `options` | `CreateAuthConfigParams` | Options for creating a new auth config |
30 +| `options?` | `CreateAuthConfigParams` | Options for creating a new auth config |
31 | `requestOptions?` | `ComposioRequestOptions` | |
32
33 **Returns**
docs/content/reference/sdk-reference/typescript/composio.mdx
+3 -13
@@ -53,22 +53,12 @@ const composio = new Composio({
53 |------|------|-------------|
54 | `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
55 | `connectedAccounts` | `ConnectedAccounts` | Manage authenticated connections |
56 -| `create` | `(userId: string, config: \{ authConfigs?: Record<string, string>; connectedAccounts?: Record<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?: ...[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: ... \| ... \| ... \| ...[] \| \{ disable?: ...[]; enable?: ...[] \}; toolkits?: string[] \| \{ disable: ...[] \} \| \{ enable: ...[] \}; tools?: Record<string, ...[] \| \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Creates a new tool router session for a user.
57 -Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
58 -should be exposed directly; see `ToolRouterCreateSessionConfig`. |
59 -| `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases.
60 -Prefer domain-specific mounts (for example
61 -`composio.connectedAccounts.updateAcl(...)`) when available; this
62 -namespace keeps compatibility aliases while APIs are experimental.
63 -Stateless experimental factories (e.g. `experimental_createTool`) stay
64 -at the top level. |
56 +| `create` | `(userId: string, config: \{ authConfigs?: Record<string, string>; connectedAccounts?: Record<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?: ...[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: ... \| ... \| ... \| ...[] \| \{ disable?: ...[]; enable?: ...[] \}; toolkits?: string[] \| \{ disable: ...[] \} \| \{ enable: ...[] \}; tools?: Record<string, ...[] \| \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Creates a new tool router session for a user. Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools should be exposed directly; see `ToolRouterCreateSessionConfig`. |
57 +| `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases. Prefer domain-specific mounts (for example `composio.connectedAccounts.updateAcl(...)`) when available; this namespace keeps compatibility aliases while APIs are experimental. Stateless experimental factories (e.g. `experimental_createTool`) stay at the top level. |
58 | `files` | `Files` | Upload and download files |
59 | `mcp` | `MCP` | Model Context Protocol server management. |
60 | `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
68 -| `sessions` | `Sessions` | Create and reuse Composio sessions.
69 -
70 -Prefer `composio.sessions.create(...)` for new code. The top-level
71 -`composio.create(...)` method is kept as an alias. |
61 +| `sessions` | `Sessions` | Create and reuse Composio sessions. Prefer `composio.sessions.create(...)` for new code. The top-level `composio.create(...)` method is kept as an alias. |
62 | `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
63 | `toolRouter` | `ToolRouter` | Legacy alias for `composio.sessions`. |
64 | `tools` | `Tools` | List, retrieve, and execute tools |
docs/content/reference/sdk-reference/typescript/toolkits.mdx
+4 -4
@@ -98,7 +98,7 @@ console.log(githubToolkit.authConfigDetails); // Authentication configuration de
98 Retrieves the fields required for creating an auth config for a toolkit.
99
100 ```typescript
101 -async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
101 +async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
102 ```
103
104 **Parameters**
@@ -107,7 +107,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
107 |------|------|-------------|
108 | `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
109 | `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
110 -| `options` | `\{ requiredOnly?: boolean \}` | |
110 +| `options?` | `\{ requiredOnly?: boolean \}` | |
111
112 **Returns**
113
@@ -120,7 +120,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
120 Retrieves the fields required for initiating a connected account for a toolkit.
121
122 ```typescript
123 -async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
123 +async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
124 ```
125
126 **Parameters**
@@ -129,7 +129,7 @@ async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthS
129 |------|------|-------------|
130 | `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
131 | `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
132 -| `options` | `\{ requiredOnly?: boolean \}` | |
132 +| `options?` | `\{ requiredOnly?: boolean \}` | |
133
134 **Returns**
135
docs/content/reference/sdk-reference/typescript/triggers.mdx
+3 -6
@@ -311,7 +311,7 @@ await composio.triggers.setWebhookSubscription({
311 Subscribe to all the triggers
312
313 ```typescript
314 -async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters: TriggerSubscribeParams, onSubscriptionError?: (data: Record<string, unknown>) => void): Promise<void>
314 +async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters?: TriggerSubscribeParams, onSubscriptionError?: (data: Record<string, unknown>) => void): Promise<void>
315 ```
316
317 **Parameters**
@@ -319,11 +319,8 @@ async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters: TriggerSub
319 | Name | Type | Description |
320 |------|------|-------------|
321 | `fn` | `(_data: IncomingTriggerPayload) => void` | The function to call when a trigger is received |
322 -| `filters` | `TriggerSubscribeParams` | The filters to apply to the triggers |
323 -| `onSubscriptionError?` | `(data: Record<string, unknown>) => void` | Optional callback invoked with the raw Pusher payload when
324 -the underlying subscription fails (for example on auth or permission rejection). The
325 -subscribe promise still resolves; this is the only programmatic signal of the failure.
326 -Errors thrown from — or promises rejected by — the callback are contained and logged. |
322 +| `filters?` | `TriggerSubscribeParams` | The filters to apply to the triggers |
323 +| `onSubscriptionError?` | `(data: Record<string, unknown>) => void` | Optional callback invoked with the raw Pusher payload when the underlying subscription fails (for example on auth or permission rejection). The subscribe promise still resolves; this is the only programmatic signal of the failure. Errors thrown from — or promises rejected by — the callback are contained and logged. |
324
325 **Returns**
326
ts/packages/core/scripts/generate-docs.ts
+14 -4
@@ -233,6 +233,12 @@ interface TypeDocParameter {
233 defaultValue?: string;
234 }
235
236 +export function isParameterRequired(
237 + param: Pick<TypeDocParameter, 'flags' | 'defaultValue'>
238 +): boolean {
239 + return !param.flags?.isOptional && param.defaultValue === undefined;
240 +}
241 +
242 interface TypeDocType {
243 type: string;
244 name?: string;
@@ -750,7 +756,7 @@ function extractMethod(reflection: TypeDocReflection): MethodDoc | null {
756 // Clean up ugly TypeScript internal names
757 name: param.name.startsWith('__') ? 'options' : param.name,
758 type: sourceTypes?.parameters.get(param.name) ?? formatType(param.type),
753 - required: !param.flags?.isOptional,
759 + required: isParameterRequired(param),
760 description: extractDescription(param.comment),
761 default: param.defaultValue,
762 }));
@@ -897,7 +903,7 @@ function generateMethodMdx(method: MethodDoc): string {
903 lines.push('|------|------|-------------|');
904 for (const param of sig.parameters) {
905 const opt = param.required ? '' : '?';
900 - const desc = escapeTextForMdx(param.description || '');
906 + const desc = escapeTableTextForMdx(param.description || '');
907 const typeCell = escapeTypeForMdx(simplifyTypeForTable(param.type));
908 lines.push(`| \`${param.name}${opt}\` | \`${typeCell}\` | ${desc} |`);
909 }
@@ -1025,7 +1031,7 @@ function generateClassMdx(classDoc: ClassDoc): string {
1031 lines.push('|------|------|-------------|');
1032 for (const prop of publicProps) {
1033 const typeCell = escapeTypeForMdx(simplifyTypeForTable(prop.type));
1028 - const safeDesc = escapeTextForMdx(prop.description || '');
1034 + const safeDesc = escapeTableTextForMdx(prop.description || '');
1035 lines.push(`| \`${prop.name}\` | \`${typeCell}\` | ${safeDesc} |`);
1036 }
1037 } else {
@@ -1070,6 +1076,10 @@ export function escapeTextForMdx(str: string): string {
1076 .replace(/>/g, '&gt;');
1077 }
1078
1079 +export function escapeTableTextForMdx(str: string): string {
1080 + return escapeTextForMdx(str).replace(/\s*\n\s*/g, ' ');
1081 +}
1082 +
1083 // Clean up internal generic type parameters that don't add value for users
1084 function cleanupGenericTypes(type: string): string {
1085 // Remove generic parameters that are just implementation details
@@ -1254,7 +1264,7 @@ async function main() {
1264 const classesTable = documented
1265 .map(
1266 ({ name, description }) =>
1257 - `| [\`${displayNameFor(name)}\`](/reference/sdk-reference/typescript/${slugFor(name)}) | ${escapeTextForMdx(description)} |`
1267 + `| [\`${displayNameFor(name)}\`](/reference/sdk-reference/typescript/${slugFor(name)}) | ${escapeTableTextForMdx(description)} |`
1268 )
1269 .join('\n');
1270
ts/packages/core/test/scripts/generate-docs.test.ts
+12
@@ -4,8 +4,10 @@ import { join } from 'node:path';
4 import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
5 import {
6 discoverModelFiles,
7 + escapeTableTextForMdx,
8 escapeTextForMdx,
9 escapeTypeForMdx,
10 + isParameterRequired,
11 parseSourceSignatureTypesAtLine,
12 runTypeDocCommand,
13 simplifyTypeForSignature,
@@ -49,6 +51,16 @@ describe('generate-docs type rendering', () => {
51 );
52 });
53
54 + it('keeps multiline descriptions in one table cell', () => {
55 + expect(escapeTableTextForMdx('First line\n second line')).toBe('First line second line');
56 + });
57 +
58 + it('treats optional and default-valued parameters as optional', () => {
59 + expect(isParameterRequired({ flags: { isOptional: true } })).toBe(false);
60 + expect(isParameterRequired({ defaultValue: '{}' })).toBe(false);
61 + expect(isParameterRequired({})).toBe(true);
62 + });
63 +
64 it('reads named parameter and return types from source signatures', () => {
65 const source = `
66 class Example {