MCPcopy
hub / github.com/simstudioai/sim / getAllTriggerBlocks

Function getAllTriggerBlocks

apps/sim/lib/workflows/triggers/trigger-utils.ts:163–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161 * This includes both dedicated trigger blocks and tools with trigger capabilities
162 */
163export function getAllTriggerBlocks(): TriggerInfo[] {
164 const allBlocks = getAllBlocks()
165 const triggers: TriggerInfo[] = []
166
167 for (const block of allBlocks) {
168 // Skip hidden blocks
169 if (block.hideFromToolbar) continue
170
171 // Check if it's a core trigger block (category: 'triggers')
172 if (block.category === 'triggers') {
173 triggers.push({
174 id: block.type,
175 name: block.name,
176 description: block.description,
177 icon: block.icon,
178 color: block.bgColor,
179 category: 'core',
180 enableTriggerMode: hasTriggerCapability(block),
181 })
182 }
183 // Check if it's a tool with trigger capability (has trigger-config subblock)
184 else if (hasTriggerCapability(block)) {
185 triggers.push({
186 id: block.type,
187 name: block.name,
188 description: block.description.replace(' or trigger workflows from ', ', trigger from '),
189 icon: block.icon,
190 color: block.bgColor,
191 category: 'integration',
192 enableTriggerMode: true,
193 })
194 }
195 }
196
197 // Sort: core triggers first, then integration triggers, alphabetically within each category
198 return triggers.sort((a, b) => {
199 if (a.category !== b.category) {
200 return a.category === 'core' ? -1 : 1
201 }
202 return a.name.localeCompare(b.name)
203 })
204}
205
206/**
207 * Check if a block has trigger capability (contains trigger mode subblocks)

Callers

nothing calls this directly

Calls 4

getAllBlocksFunction · 0.90
hasTriggerCapabilityFunction · 0.85
replaceMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected