@devries-cameron20 / composio Mirror · read-only / commits / b922e92a0
Fork 0

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, 07:00 UTC

fix(cli): use trigger detail endpoint for triggers info

Fetch trigger metadata via the dedicated retrieve API instead of listing and filtering client-side, improving correctness and efficiency for info lookups. Co-authored-by: Cursor <cursoragent@cursor.com>

haxzie committed Feb 23, 2026 at 19:33 UTC b922e92a059e7c446967311fc20584ea6e3aa182
4 files changed +50 -18
ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.ts
+19 -18
@@ -34,25 +34,26 @@ export const triggersCmd$Info = Command.make('info', { slug }, ({ slug }) =>
34 }
35
36 const slugValue = slug.value;
37 - const triggerTypes = yield* ui.withSpinner('Fetching trigger types...', repo.getTriggerTypes());
38 - const normalizedSlug = slugValue.toUpperCase();
39 - const triggerType = triggerTypes.find(item => item.slug.toUpperCase() === normalizedSlug);
37 + const triggerType = yield* ui
38 + .withSpinner('Fetching trigger type details...', repo.getTriggerTypeDetailed(slugValue))
39 + .pipe(
40 + Effect.catchTag('services/HttpServerError', e =>
41 + Effect.if(e.status === 404, {
42 + onTrue: () =>
43 + ui.log
44 + .error(`Trigger "${slugValue}" not found.`)
45 + .pipe(
46 + Effect.zipRight(
47 + ui.log.step('Browse available trigger types:\n> composio triggers list')
48 + ),
49 + Effect.as(undefined)
50 + ),
51 + onFalse: () => Effect.fail(e),
52 + })
53 + )
54 + );
55
41 - if (!triggerType) {
42 - yield* ui.log.error(`Trigger "${slugValue}" not found.`);
43 - const suggestions = triggerTypes
44 - .filter(item => item.slug.toUpperCase().includes(normalizedSlug))
45 - .slice(0, 3);
46 - if (suggestions.length > 0) {
47 - yield* ui.log.step('Did you mean:');
48 - yield* Effect.forEach(suggestions, item =>
49 - ui.log.step(`> composio triggers info "${item.slug}"`)
50 - );
51 - } else {
52 - yield* ui.log.step('Browse available trigger types:\n> composio triggers list');
53 - }
54 - return;
55 - }
56 + if (!triggerType) return;
57
58 yield* ui.log.info(formatTriggerTypeInfo(triggerType));
59
ts/packages/cli/src/services/composio-clients-cached.ts
+3
@@ -180,6 +180,9 @@ export const ComposioToolkitsRepositoryCached = Layer.effect(
180 );
181 },
182
183 + // Trigger type detail should NOT be cached (single-item fetch, should be fresh)
184 + getTriggerTypeDetailed: slug => underlyingRepository.getTriggerTypeDetailed(slug),
185 +
186 getTriggerTypes: (toolkitSlugs?: ReadonlyArray<string>) => {
187 const cacheFilter =
188 toolkitSlugs && toolkitSlugs.length > 0
ts/packages/cli/src/services/composio-clients.ts
+17
@@ -1083,6 +1083,18 @@ export class ComposioClientLive extends Effect.Service<ComposioClientLive>()(
1083 TriggerTypesAsEnumsResponse
1084 )
1085 ),
1086 + /**
1087 + * Retrieves detailed info about a single trigger type by slug.
1088 + * @param slug - Trigger type slug (e.g. "GMAIL_NEW_GMAIL_MESSAGE")
1089 + */
1090 + retrieve: (slug: string) =>
1091 + withMetrics(
1092 + callClient(
1093 + clientSingleton,
1094 + client => client.triggersTypes.retrieve(slug),
1095 + TriggerType
1096 + )
1097 + ),
1098 /**
1099 * Retrieve a list of trigger types, automatically handling pagination.
1100 * @param toolkitSlugs - Optional array of toolkit slugs to filter by
@@ -1246,6 +1258,11 @@ export class ComposioToolkitsRepository extends Effect.Service<ComposioToolkitsR
1258 )
1259 ),
1260 getTriggerTypesAsEnums: () => client.triggersTypes.retrieveEnum(),
1261 + /**
1262 + * Retrieves detailed info about a single trigger type by slug.
1263 + * @param slug - Trigger type slug (e.g. "GMAIL_NEW_GMAIL_MESSAGE")
1264 + */
1265 + getTriggerTypeDetailed: (slug: string) => client.triggersTypes.retrieve(slug),
1266 /**
1267 * Fetches trigger types with optional toolkit filtering.
1268 * When toolkitSlugs is provided, fetches all matching trigger types.
ts/packages/cli/test/__utils__/services/test-layer.ts
+11
@@ -184,6 +184,17 @@ export const TestLayer = (input?: TestLiveInput) =>
184 }
185 return Effect.succeed(triggers);
186 },
187 + getTriggerTypeDetailed: (slug: string) => {
188 + const found = toolkitsData.triggerTypes.find(
189 + trigger => trigger.slug.toUpperCase() === slug.toUpperCase()
190 + );
191 + if (!found) {
192 + return Effect.fail(
193 + new HttpServerError({ cause: `Trigger type "${slug}" not found`, status: 404 })
194 + );
195 + }
196 + return Effect.succeed(found);
197 + },
198 getTools: (toolkitSlugs?: ReadonlyArray<string>) => {
199 let tools = toolkitsData.tools;
200 if (toolkitSlugs && toolkitSlugs.length > 0) {