Skip to main content
Glama
156554395

Doubao Image/Video Generation MCP Server

by 156554395
queryVideoTask.ts1.42 kB
/** * 豆包视频任务查询工具 * API 文档: https://www.volcengine.com/docs/82379/1521309 */ 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; }; } const BASE_URL = "https://ark.cn-beijing.volces.com/api/v3"; 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)}` ); } }

Implementation Reference

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