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.

5 min readSume
All posts

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.

script_run limits and rules from the Sume hosted MCP docs (read 2026-10-05)
ItemRule
timeout_seconds5 to 55
max_callsCaps the number of tool calls in the run
max_paid_callsCaps paid creates, such as tts_create
Paid createsEach still needs its own idempotency_key
Discovery tools and script_runA script cannot call them
Child jobsReturned 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 to jobs_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_result and join the audio with timeline audio concat, which takes 1 to 20 parts.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume