Skip to main content
Glama
156554395

Doubao Image/Video Generation MCP Server

by 156554395

query_video_task

Check the status and results of asynchronous video generation tasks, retrieving download URLs when complete.

Instructions

查询豆包视频生成任务的状态和结果

视频生成是异步任务,需要使用此工具查询任务状态:

  • pending: 任务等待中

  • processing: 任务处理中

  • success: 任务成功完成

  • failed: 任务失败

参数说明:

  • task_id: 任务 ID (必需,由 generate_video 返回)

返回: 任务状态和结果 (成功时包含视频下载 URL)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes视频生成任务 ID

Implementation Reference

  • The main handler function that executes the tool logic: makes API call to query video task status using fetch.
    export async function queryVideoTask( apiKey: string, taskId: string ): Promise<QueryVideoTaskResponse> { if (!taskId) { throw new Error("task_id 不能为空"); } try { const response = await fetch( `${BASE_URL}/contents/generations/tasks/${taskId}`, { method: "GET", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, } ); const result: QueryVideoTaskResponse = await response.json(); // 只在 HTTP 响应不成功时抛出错误 // 如果 code 不是 0,但响应是 200,仍然返回结果(可能是任务处理中) if (!response.ok) { throw new Error( `查询视频任务失败: ${result.msg || response.statusText}` ); } return result; } catch (error) { throw new Error( `查询视频任务请求失败: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Type definition for the response from the query video task API.
    interface QueryVideoTaskResponse { code: number; msg: string; data?: { task_id: string; status: "pending" | "processing" | "success" | "failed"; video_url?: string; cover_url?: string; error_msg?: string; created_at?: string; finished_at?: string; }; }
  • src/index.ts:202-225 (registration)
    MCP tool registration in the listTools handler, including name, description, and input schema.
    name: "query_video_task", description: `查询豆包视频生成任务的状态和结果 视频生成是异步任务,需要使用此工具查询任务状态: - pending: 任务等待中 - processing: 任务处理中 - success: 任务成功完成 - failed: 任务失败 参数说明: - task_id: 任务 ID (必需,由 generate_video 返回) 返回: 任务状态和结果 (成功时包含视频下载 URL)`, inputSchema: { type: "object", properties: { task_id: { type: "string", description: "视频生成任务 ID", }, }, required: ["task_id"], }, },
  • src/index.ts:274-285 (registration)
    Dispatcher case in CallToolRequestSchema handler that invokes the queryVideoTask function.
    case "query_video_task": { const taskId = typeof args.task_id === "string" ? args.task_id : String(args.task_id); const result = await queryVideoTask(API_KEY, taskId); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/156554395/doubao-image-video-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server