> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lofty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# generate_lead_insight

> Produce a call script, a prepare-insight, a call summary, or queue a lead analysis.

> [!WARNING]
>
> **WRITE** · 4 operations · may change data

Produce a call script, a prepare-insight, a call summary, or queue a lead analysis. Generating is a write — reading a cached result is [`search_lead_insights`](https://developer.lofty.com/mcp/tools/search-lead-insights).

Each `kind` needs its own id — there is no single shared `lead_id` shape:

```js theme={null}
// kind=call_script: lead_id and task_id are both required.
generate_lead_insight({ kind: "call_script", lead_id, task_id })

// kind=insight: lead_id and appointment_id are both required.
generate_lead_insight({ kind: "insight", lead_id, appointment_id })

// kind=call_summary: lead_id and call_record_id are both required.
generate_lead_insight({ kind: "call_summary", lead_id, call_record_id })

// kind=analysis: lead_ids (up to 10), not lead_id.
generate_lead_insight({ kind: "analysis", lead_ids: [lead_id, ...] })
```

> [!WARNING]
>
> `kind: "insight"` generation is slow enough that it routinely exceeds the gateway's own request timeout. A timeout error there does **not** mean the request was rejected — only that the response didn't arrive in time. There's no separate way to check whether it finished; if it matters, retry once before telling the user it failed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.