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

Function fetchWorkflowMetadata

apps/sim/providers/utils.ts:71–96  ·  view source on GitHub ↗

* Fetches workflow metadata (name and description) from the API

(
  workflowId: string
)

Source from the content-addressed store, hash-verified

69 * Fetches workflow metadata (name and description) from the API
70 */
71async function fetchWorkflowMetadata(
72 workflowId: string
73): Promise<{ name: string; description: string | null } | null> {
74 try {
75 const { buildAuthHeaders, buildAPIUrl } = await import('@/executor/utils/http')
76
77 const headers = await buildAuthHeaders()
78 const url = buildAPIUrl(`/api/workflows/${workflowId}`)
79
80 const response = await fetch(url.toString(), { headers })
81 if (!response.ok) {
82 await response.text().catch(() => {})
83 logger.warn(`Failed to fetch workflow metadata for ${workflowId}`)
84 return null
85 }
86
87 const { data } = await response.json()
88 return {
89 name: data?.name || 'Workflow',
90 description: data?.description || null,
91 }
92 } catch (error) {
93 logger.error('Error fetching workflow metadata:', error)
94 return null
95 }
96}
97
98/**
99 * Client-safe provider metadata.

Callers 1

transformBlockToolFunction · 0.85

Calls 6

buildAPIUrlFunction · 0.85
textMethod · 0.80
errorMethod · 0.80
warnMethod · 0.65
buildAuthHeadersFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected