Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions lib/composio/connectors/getConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ export interface ConnectorInfo {
connectedAccountId?: string;
}

/**
* All toolkit slugs the platform supports.
* Passed explicitly to composio.create() because session.toolkits()
* only returns the first 20 by default.
*/
const SUPPORTED_TOOLKITS = [
"googlesheets",
"googledrive",
"googledocs",
"tiktok",
];

/**
* Options for getting connectors.
*/
Expand Down Expand Up @@ -37,13 +49,18 @@ export async function getConnectors(
const { displayNames = {} } = options;
const composio = await getComposioClient();

const session = await composio.create(accountId);
const session = await composio.create(accountId, {
toolkits: SUPPORTED_TOOLKITS,
});
const toolkits = await session.toolkits();

return toolkits.items.map(toolkit => ({
slug: toolkit.slug,
name: displayNames[toolkit.slug] || toolkit.name,
isConnected: toolkit.connection?.isActive ?? false,
connectedAccountId: toolkit.connection?.connectedAccount?.id,
}));
return toolkits.items.map(toolkit => {
const slug = toolkit.slug.toLowerCase();
return {
slug,
name: displayNames[slug] || toolkit.name,
isConnected: toolkit.connection?.isActive ?? false,
connectedAccountId: toolkit.connection?.connectedAccount?.id,
};
});
}
Loading