Skip to content

fix: normalize Composio toolkit slugs to lowercase#253

Merged
sweetmantech merged 2 commits intotestfrom
fix/normalize-connector-slugs
Mar 3, 2026
Merged

fix: normalize Composio toolkit slugs to lowercase#253
sweetmantech merged 2 commits intotestfrom
fix/normalize-connector-slugs

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Mar 3, 2026

Summary

  • Composio returns some toolkit slugs in uppercase (e.g., TIKTOK instead of tiktok)
  • This caused display name lookups and client-side filtering to miss TikTok entirely
  • Normalize slugs to lowercase in getConnectors so all downstream code works consistently

Test plan

  • Verify TikTok appears in artist connectors tab
  • Verify Google Sheets/Docs/Drive still appear on account connectors page
  • Verify display names resolve correctly for all connectors

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for detecting connectors across multiple toolkits during session initialization, improving connector discovery.
  • Bug Fixes

    • Normalized connector slug handling to consistently use lowercase values, improving lookup and display consistency.

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]>
@vercel
Copy link
Contributor

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Mar 3, 2026 3:32am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1768ab and 9792460.

📒 Files selected for processing (1)
  • lib/composio/connectors/getConnectors.ts

📝 Walkthrough

Walkthrough

getConnectors 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

Cohort / File(s) Summary
Connectors logic
lib/composio/connectors/getConnectors.ts
Adds SUPPORTED_TOOLKITS and passes it to composio.create(accountId, { toolkits: SUPPORTED_TOOLKITS }). Normalizes toolkit.slug with .toLowerCase() once per toolkit and uses that lowercased slug for the returned slug, displayNames lookup, and mapping fields (name, isConnected, connectedAccountId).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🧭 Toolkits gathered, a list in tow,

slugs softened down to lowercase flow,
session starts with a clearer aim,
ConnectorInfo sings a steadier name,
neat mapping now, tidy and tame.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Solid & Clean Code ✅ Passed Pull request implements slug normalization at the optimal abstraction level with simple, maintainable logic that adheres to SOLID principles and clean code practices.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/normalize-connector-slugs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lib/composio/connectors/getConnectors.ts (1)

43-47: Normalize displayNames keys 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.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2265e8e and a1768ab.

📒 Files selected for processing (1)
  • lib/composio/connectors/getConnectors.ts

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]>
@sweetmantech sweetmantech merged commit bfd89f3 into test Mar 3, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant