sora_get_tasks_batch
Query multiple video generation tasks in a single request to check their status and retrieve video information efficiently for batch tracking.
Instructions
Query multiple video generation tasks at once.
Efficiently check the status of multiple tasks in a single request.
More efficient than calling sora_get_task multiple times.
Use this when:
- You have multiple pending generations to check
- You want to get status of several videos at once
- You're tracking a batch of generations
Returns:
Status and video information for all queried tasks.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_ids | Yes | List of task IDs to query. Maximum recommended batch size is 50 tasks. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- tools/task_tools.py:53-77 (handler)The async handler function for the 'sora_get_tasks_batch' MCP tool. It accepts a list of task IDs, calls client.query_task with ids and action='retrieve_batch', and returns the formatted result.
@mcp.tool() async def sora_get_tasks_batch( task_ids: Annotated[ list[str], Field(description="List of task IDs to query. Maximum recommended batch size is 50 tasks."), ], ) -> str: """Query multiple video generation tasks at once. Efficiently check the status of multiple tasks in a single request. More efficient than calling sora_get_task multiple times. Use this when: - You have multiple pending generations to check - You want to get status of several videos at once - You're tracking a batch of generations Returns: Status and video information for all queried tasks. """ result = await client.query_task( ids=task_ids, action="retrieve_batch", ) return format_batch_task_result(result) - tools/task_tools.py:13-13 (registration)The @mcp.tool() decorator registers 'sora_get_tasks_batch' (and 'sora_get_task') as MCP tools. The function name becomes the tool name.
@mcp.tool() - core/utils.py:90-99 (helper)The 'format_batch_task_result' helper function that formats the batch query result as a pretty-printed JSON string.
def format_batch_task_result(data: dict[str, Any]) -> str: """Format batch task query result as JSON. Args: data: API response dictionary Returns: JSON string representation of the result """ return json.dumps(data, ensure_ascii=False, indent=2) - core/client.py:176-180 (helper)The 'query_task' method on the SoraClient class. The batch tool calls this with ids=task_ids and action='retrieve_batch', which sends a POST to the /sora/tasks endpoint.
async def query_task(self, **kwargs: Any) -> dict[str, Any]: """Query task status using the tasks endpoint.""" task_id = kwargs.get("id") or kwargs.get("ids", []) logger.info(f"🔍 Querying task(s): {task_id}") return await self.request("/sora/tasks", kwargs) - core/utils.py:68-68 (helper)The 'format_video_result' helper references 'sora_get_tasks_batch' as the batch_poll_tool for async submission guidance.
_with_submission_guidance(data, "sora_get_task", "sora_get_tasks_batch"),