script_run for one TTS clip per sentence: limits to set first
Fan out one tts_create per sentence inside Sume script_run, with timeout_seconds, max_calls and max_paid_calls set, then wait on the child jobs with jobs_wait.

For a voiceover with many sentences on Sume hosted MCP, use script_run and call tts_create once per sentence inside it. The MCP docs give this as the first use case: three or more independent calls of the same shape. Set timeout_seconds, max_calls and max_paid_calls before you run, because every tts_create is a paid create that bills when it is accepted.
What script_run does
script_run runs a short JavaScript program on the Sume side. Inside it, await sume.call(name, arguments) runs any listed tool with the same gates, redaction and errors as a direct call. The response has the returned value, a calls[] journal, and the child jobs[] that you pass to jobs_wait.
| Item | Rule |
|---|---|
| timeout_seconds | 5 to 55 |
| max_calls | Caps the number of tool calls in the run |
| max_paid_calls | Caps paid creates, such as tts_create |
| Paid creates | Each still needs its own idempotency_key |
| Discovery tools and script_run | A script cannot call them |
| Child jobs | Returned as jobs[], to use with jobs_wait |
Why the paid cap comes first
A loop over a long script is easy to get wrong: a split on the wrong character can turn one paragraph into hundreds of calls. max_paid_calls is the hard stop. Set it to the sentence count you expect, with no margin you would not pay for.
Idempotency per sentence
Each sentence call needs its own idempotency_key. Derive it from the script, the sentence index and the voice, so a rerun after a transport error reuses the same jobs and does not pay for them again. The jobs endpoint says a timeout is a transport failure, not a job outcome.
After the run
- Pass the returned
jobs[]ids tojobs_wait. It takes 1 to 20 ids and slices at 55 seconds at most. If your script has more than 20 sentences, wait in groups. - If a wait returns without terminal jobs, wait again on the same ids. Do not submit the creates again.
- Read each result with
jobs_resultand join the audio with timeline audioconcat, which takes 1 to 20 parts.
Sources
Related posts
More in Developers
- script_run error script_tool_forbidden: discovery calls belong outside
script_tool_forbidden means a Sume script called a discovery tool (tools_list, tools_schema, mcp_health, search_tools) or script_run. Call them from the turn.
- script_text, words, cues or segments: which caption input to send
Sume captions take only one of script_text, words, cues, segments. Your pick decides whether speech-to-text runs and what happens on a silent clip.
- SDK waitForJob reads per minute: the 2-second floor, and 10 jobs
The Sume SDK polls a job at least every 2 seconds, and a longer next_poll_after_seconds wins. That is up to 30 reads a minute per job. A webhook removes them.
- See every webhook attempt for a Sume video job: webhook.delivery
Did Sume reach your endpoint? Read webhook_delivery on the job and the webhook.delivery events: statuses pending to exhausted, last_error and attempt count.
Written by Sume