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.

fix: address PR review comments — docstrings, alias in session.authorize

abir002b20f11f7a
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.py
index c291b4c16..416bb4af8 100644
--- a/python/composio/core/models/connected_accounts.py
+++ b/python/composio/core/models/connected_accounts.py
@@ -366,7 +366,7 @@ class ConnectedAccounts:
Update a connected account's alias.
:param nanoid: The unique identifier of the connected account.
- :param alias: Human-readable alias for the account. Must be unique per entity
+ :param alias: Human-readable alias for the account. Must be unique per userId
and toolkit within the project. Pass an empty string to clear.
:return: Dict with ``success``, and optionally ``id`` and ``status``.
@@ -411,7 +411,7 @@ class ConnectedAccounts:
:param callback_url: Callback URL to use for OAuth apps.
:param config: The configuration to create the connected account with.
:param allow_multiple: Whether to allow multiple connected accounts for the same user and auth config.
- :param alias: Optional human-readable alias for the account. Must be unique per entity and toolkit within the project.
+ :param alias: Optional human-readable alias for the account. Must be unique per userId and toolkit within the project.
:return: The connection request.
"""
# Check if there are multiple connected accounts for the authConfig of the user
diff --git a/ts/packages/core/src/models/ConnectedAccounts.ts b/ts/packages/core/src/models/ConnectedAccounts.ts
index 48855eeb3..f89d94925 100644
--- a/ts/packages/core/src/models/ConnectedAccounts.ts
+++ b/ts/packages/core/src/models/ConnectedAccounts.ts
@@ -486,7 +486,7 @@ export class ConnectedAccounts {
*
* @param {string} nanoid - The unique identifier of the connected account
* @param {UpdateConnectedAccountParams} params - The update parameters
- * @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.
+ * @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.
* @returns {Promise<UpdateConnectedAccountResponse>} The update response
*
* @example
diff --git a/ts/packages/core/src/models/ToolRouterSession.ts b/ts/packages/core/src/models/ToolRouterSession.ts
index 53dff54d3..73cae7b4e 100644
--- a/ts/packages/core/src/models/ToolRouterSession.ts
+++ b/ts/packages/core/src/models/ToolRouterSession.ts
@@ -186,11 +186,18 @@ export class ToolRouterSession<
* Initiate an authorization flow for a toolkit.
* Returns a ConnectionRequest with a redirect URL for the user.
*/
- async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<ConnectionRequest> {
- const response = await this.client.toolRouter.session.link(this.sessionId, {
- ...(options?.callbackUrl ? { callback_url: options.callbackUrl } : {}),
- toolkit,
- });
+ async authorize(toolkit: string, options?: { callbackUrl?: string; alias?: string }): Promise<ConnectionRequest> {
+ const linkParams: { toolkit: string; callback_url?: string; alias?: string } = { toolkit };
+
+ if (options?.callbackUrl) {
+ linkParams.callback_url = options.callbackUrl;
+ }
+
+ if (options?.alias != null) {
+ linkParams.alias = options.alias;
+ }
+
+ const response = await this.client.toolRouter.session.link(this.sessionId, linkParams);
return createConnectionRequest(
this.client,
diff --git a/ts/packages/core/src/types/connectedAccounts.types.ts b/ts/packages/core/src/types/connectedAccounts.types.ts
index 740682e76..e91fb24a3 100644
--- a/ts/packages/core/src/types/connectedAccounts.types.ts
+++ b/ts/packages/core/src/types/connectedAccounts.types.ts
@@ -192,7 +192,7 @@ export const CreateConnectedAccountLinkOptionsSchema = z.object({
*/
callbackUrl: z.string().optional(),
/**
- * Human-readable alias for the connected account. Must be unique per entity and toolkit within the project.
+ * Human-readable alias for the connected account. Must be unique per userId and toolkit within the project.
*/
alias: z.string().optional(),
});
@@ -217,7 +217,7 @@ export const UpdateConnectedAccountParamsSchema = z.object({
alias: z
.string()
.describe(
- 'Human-readable alias for the account. Must be unique per entity and toolkit within the project. Pass an empty string to clear the alias.'
+ 'Human-readable alias for the account. Must be unique per userId and toolkit within the project. Pass an empty string to clear the alias.'
),
});
export type UpdateConnectedAccountParams = z.infer<typeof UpdateConnectedAccountParamsSchema>;
diff --git a/ts/packages/core/src/types/toolRouter.types.ts b/ts/packages/core/src/types/toolRouter.types.ts
index 9a9c005aa..d3b707781 100644
--- a/ts/packages/core/src/types/toolRouter.types.ts
+++ b/ts/packages/core/src/types/toolRouter.types.ts
@@ -212,7 +212,7 @@ export const ToolRouterCreateSessionConfigSchema = z
.boolean()
.optional()
.describe(
- 'When true, enables multi-account mode for this session. When not set, falls back to org/project-level configuration.'
+ 'When true, enables multi-account mode for this session. Defaults to false.'
),
maxAccountsPerToolkit: z
.number()