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

Function fetchWorkflowInputFields

apps/sim/tools/params.ts:662–682  ·  view source on GitHub ↗

* Fetches workflow input fields from the API.

(
  workflowId: string
)

Source from the content-addressed store, hash-verified

660 * Fetches workflow input fields from the API.
661 */
662async function fetchWorkflowInputFields(
663 workflowId: string
664): Promise<Array<{ name: string; type: string; description?: string }>> {
665 try {
666 const { buildAuthHeaders, buildAPIUrl } = await import('@/executor/utils/http')
667
668 const headers = await buildAuthHeaders()
669 const url = buildAPIUrl(`/api/workflows/${workflowId}`)
670
671 const response = await fetch(url.toString(), { headers })
672 if (!response.ok) {
673 throw new Error('Failed to fetch workflow')
674 }
675
676 const { data } = await response.json()
677 return extractInputFieldsFromBlocks(data?.state?.blocks)
678 } catch (error) {
679 logger.error('Error fetching workflow input fields:', error)
680 return []
681 }
682}
683
684/**
685 * Creates a complete tool schema for execution with all parameters

Callers 1

Calls 5

buildAPIUrlFunction · 0.85
errorMethod · 0.80
buildAuthHeadersFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected