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, 00:45 UTC
fix: address PR review comments — docstrings, alias in session.authorize
- Change 'per entity' to 'per userId' in alias docstrings (TS + Python) - Change enable description to 'Defaults to false' (was claiming org/project-level fallback that doesn't exist) - Add alias support to session.authorize with clean if-checks - Clean up conditional spread in session.authorize Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Zen Agent <zen@composio.dev>
abir committed
Apr 9, 2026 at 06:27 UTC
002b20f11f7a0cf19527c3b70161c447283c6e94
5 files changed
+18
-11
python/composio/core/models/connected_accounts.py
+2
-2
@@ -366,7 +366,7 @@ class ConnectedAccounts:
366
Update a connected account's alias.
367
368
:param nanoid: The unique identifier of the connected account.
369
- :param alias: Human-readable alias for the account. Must be unique per entity
369
+ :param alias: Human-readable alias for the account. Must be unique per userId
370
and toolkit within the project. Pass an empty string to clear.
371
:return: Dict with ``success``, and optionally ``id`` and ``status``.
372
@@ -411,7 +411,7 @@ class ConnectedAccounts:
411
:param callback_url: Callback URL to use for OAuth apps.
412
:param config: The configuration to create the connected account with.
413
:param allow_multiple: Whether to allow multiple connected accounts for the same user and auth config.
414
- :param alias: Optional human-readable alias for the account. Must be unique per entity and toolkit within the project.
414
+ :param alias: Optional human-readable alias for the account. Must be unique per userId and toolkit within the project.
415
:return: The connection request.
416
"""
417
# Check if there are multiple connected accounts for the authConfig of the user
ts/packages/core/src/models/ConnectedAccounts.ts
+1
-1
@@ -486,7 +486,7 @@ export class ConnectedAccounts {
486
*
487
* @param {string} nanoid - The unique identifier of the connected account
488
* @param {UpdateConnectedAccountParams} params - The update parameters
489
- * @param {string} params.alias - Human-readable alias for the account. Must be unique per entity and toolkit within the project. Pass an empty string to clear.
489
+ * @param {string} params.alias - Human-readable alias for the account. Must be unique per userId and toolkit within the project. Pass an empty string to clear.
490
* @returns {Promise<UpdateConnectedAccountResponse>} The update response
491
*
492
* @example
ts/packages/core/src/models/ToolRouterSession.ts
+12
-5
@@ -186,11 +186,18 @@ export class ToolRouterSession<
186
* Initiate an authorization flow for a toolkit.
187
* Returns a ConnectionRequest with a redirect URL for the user.
188
*/
189
- async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<ConnectionRequest> {
190
- const response = await this.client.toolRouter.session.link(this.sessionId, {
191
- ...(options?.callbackUrl ? { callback_url: options.callbackUrl } : {}),
192
- toolkit,
193
- });
189
+ async authorize(toolkit: string, options?: { callbackUrl?: string; alias?: string }): Promise<ConnectionRequest> {
190
+ const linkParams: { toolkit: string; callback_url?: string; alias?: string } = { toolkit };
191
+
192
+ if (options?.callbackUrl) {
193
+ linkParams.callback_url = options.callbackUrl;
194
+ }
195
+
196
+ if (options?.alias != null) {
197
+ linkParams.alias = options.alias;
198
+ }
199
+
200
+ const response = await this.client.toolRouter.session.link(this.sessionId, linkParams);
201
202
return createConnectionRequest(
203
this.client,
ts/packages/core/src/types/connectedAccounts.types.ts
+2
-2
@@ -192,7 +192,7 @@ export const CreateConnectedAccountLinkOptionsSchema = z.object({
192
*/
193
callbackUrl: z.string().optional(),
194
/**
195
- * Human-readable alias for the connected account. Must be unique per entity and toolkit within the project.
195
+ * Human-readable alias for the connected account. Must be unique per userId and toolkit within the project.
196
*/
197
alias: z.string().optional(),
198
});
@@ -217,7 +217,7 @@ export const UpdateConnectedAccountParamsSchema = z.object({
217
alias: z
218
.string()
219
.describe(
220
- 'Human-readable alias for the account. Must be unique per entity and toolkit within the project. Pass an empty string to clear the alias.'
220
+ 'Human-readable alias for the account. Must be unique per userId and toolkit within the project. Pass an empty string to clear the alias.'
221
),
222
});
223
export type UpdateConnectedAccountParams = z.infer<typeof UpdateConnectedAccountParamsSchema>;
ts/packages/core/src/types/toolRouter.types.ts
+1
-1
@@ -212,7 +212,7 @@ export const ToolRouterCreateSessionConfigSchema = z
212
.boolean()
213
.optional()
214
.describe(
215
- 'When true, enables multi-account mode for this session. When not set, falls back to org/project-level configuration.'
215
+ 'When true, enables multi-account mode for this session. Defaults to false.'
216
),
217
maxAccountsPerToolkit: z
218
.number()