MCPcopy Index your code
hub / github.com/simstudioai/sim / extractInputFormatFromBlocks

Function extractInputFormatFromBlocks

apps/sim/lib/mcp/workflow-tool-schema.ts:305–331  ·  view source on GitHub ↗
(
  blocks: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

303 * Looks for any valid start block and extracts its inputFormat configuration.
304 */
305export function extractInputFormatFromBlocks(
306 blocks: Record<string, unknown>
307): InputFormatField[] | null {
308 // Look for any valid start block
309 for (const [, block] of Object.entries(blocks)) {
310 if (!block || typeof block !== 'object') continue
311
312 const blockObj = block as Record<string, unknown>
313 const blockType = blockObj.type as string
314
315 if (isInputDefinitionTrigger(blockType)) {
316 // Try to get inputFormat from subBlocks.inputFormat.value
317 const subBlocks = blockObj.subBlocks as Record<string, { value?: unknown }> | undefined
318 const subBlockValue = subBlocks?.inputFormat?.value
319
320 // Try legacy config.params.inputFormat
321 const config = blockObj.config as Record<string, unknown> | undefined
322 const params = config?.params as Record<string, unknown> | undefined
323 const paramsValue = params?.inputFormat
324
325 const normalized = normalizeInputFormatValue(subBlockValue ?? paramsValue)
326 return normalized.length > 0 ? normalized : null
327 }
328 }
329
330 return null
331}

Callers 3

generateSchemaFromBlocksFunction · 0.90
McpDeployFunction · 0.90

Calls 2

isInputDefinitionTriggerFunction · 0.90

Tested by

no test coverage detected