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

Function coerceComponents

apps/sim/tools/whatsapp/send_template.ts:10–17  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

8} from '@/tools/whatsapp/utils'
9
10function coerceComponents(value: unknown): unknown[] | undefined {
11 if (value == null || value === '') return undefined
12 const parsed = typeof value === 'string' ? (JSON.parse(value) as unknown) : value
13 if (!Array.isArray(parsed)) {
14 throw new Error('Template components must be a JSON array')
15 }
16 return parsed
17}
18
19export const sendTemplateTool: ToolConfig<WhatsAppSendTemplateParams, WhatsAppSendResponse> = {
20 id: 'whatsapp_send_template',

Callers 1

send_template.tsFile · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected