fix: normalize Composio toolkit slugs to lowercase#253
Conversation
Composio returns some toolkit slugs in uppercase (e.g., "TIKTOK"). Normalize to lowercase so display name lookups and client-side filtering work consistently. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughgetConnectors now supplies a SUPPORTED_TOOLKITS list when creating the composio session, and normalizes toolkit slugs to lowercase for both returned ConnectorInfo.slug and displayNames lookups; mapping logic was updated to compute and reuse the lowercased slug. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/composio/connectors/getConnectors.ts (1)
43-47: NormalizedisplayNameskeys too to make custom mappings fully case-insensitive.Right now only toolkit slugs are normalized. If callers pass mixed-case keys in
displayNames(e.g.,TIKTOK), lookups still miss.♻️ Proposed refactor
export async function getConnectors( accountId: string, options: GetConnectorsOptions = {}, ): Promise<ConnectorInfo[]> { const { displayNames = {} } = options; + const normalizedDisplayNames = Object.fromEntries( + Object.entries(displayNames).map(([key, value]) => [key.toLowerCase(), value]), + ) as Record<string, string>; const composio = await getComposioClient(); const session = await composio.create(accountId); const toolkits = await session.toolkits(); return toolkits.items.map(toolkit => { const slug = toolkit.slug.toLowerCase(); return { slug, - name: displayNames[slug] || toolkit.name, + name: normalizedDisplayNames[slug] ?? toolkit.name, isConnected: toolkit.connection?.isActive ?? false, connectedAccountId: toolkit.connection?.connectedAccount?.id, }; }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/composio/connectors/getConnectors.ts` around lines 43 - 47, displayNames lookups are case-sensitive while toolkit slugs are lowercased, so mappings like "TIKTOK" miss; normalize the keys of displayNames before using them (e.g., build a new object or Map by lowercasing each key) and then use that normalizedDisplayNames in the toolkits.items.map block where slug is lowercased (refer to displayNames and the mapping in getConnectors.ts / the toolkits.items.map callback) so lookups are fully case-insensitive.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/composio/connectors/getConnectors.ts`:
- Around line 43-47: displayNames lookups are case-sensitive while toolkit slugs
are lowercased, so mappings like "TIKTOK" miss; normalize the keys of
displayNames before using them (e.g., build a new object or Map by lowercasing
each key) and then use that normalizedDisplayNames in the toolkits.items.map
block where slug is lowercased (refer to displayNames and the mapping in
getConnectors.ts / the toolkits.items.map callback) so lookups are fully
case-insensitive.
session.toolkits() only returns the first 20 toolkits by default, which excluded TikTok. Pass SUPPORTED_TOOLKITS explicitly to composio.create() so we get exactly the connectors we support. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
TIKTOKinstead oftiktok)getConnectorsso all downstream code works consistentlyTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes