Skip to main content
Glama
Suixinlei

Tongyi Wanxiang MCP Server

by Suixinlei

wanx-t2v-video-generation-result

Retrieve text-to-video generation results using Alibaba Cloud's Tongyi Wanxiang API by providing a task ID for tracking and accessing the output.

Instructions

获取阿里云万相文生视频大模型的文生视频结果

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes

Implementation Reference

  • src/index.ts:64-74 (registration)
    Registration of the 'wanx-t2v-video-generation-result' MCP tool, including description, input schema {task_id: string}, and a thin handler that calls the queryVideoTaskStatus helper.
    server.tool(
      "wanx-t2v-video-generation-result",
      "获取阿里云万相文生视频大模型的文生视频结果",
      { task_id: z.string() },
      async ({ task_id }) => {
        const result = await queryVideoTaskStatus(task_id);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }],
        };
      }
    );
  • The handler function passed to server.tool, which executes the tool logic by querying the task status and returning the result in MCP format.
    async ({ task_id }) => {
      const result = await queryVideoTaskStatus(task_id);
      return {
        content: [{ type: "text", text: JSON.stringify(result) }],
      };
    }
  • Zod input schema validating the task_id parameter.
    { task_id: z.string() },
  • Core helper function that polls the DashScope API for video task status until 'SUCCEEDED', then returns the video_url, or throws on failure/timeout.
    export async function queryVideoTaskStatus(taskId: string) {
      const apiKey = config.api.apiKey;
      const url = `https://dashscope.aliyuncs.com/api/v1/tasks/${taskId}`;  
      const headers = {  
        'Authorization': `Bearer ${apiKey}`  
      };  
      let videoUrl = null;
      let retries = 0;
      const maxRetries = config.maxRetries; // 从配置文件中获取最大重试次数
      const pollingInterval = config.pollingInterval; // 从配置文件中获取轮询间隔
    
      while (retries < maxRetries) {
        try {
          const res = await axios.get(url, { headers });
          // res.data.output.task_status 可能为 INITIAL, RUNNING, SUCCEEDED, FAILED, CANCELLED  
          // res.data.output.video_url 只有在 SUCCEEDED 时有值  
          if (res.data.output.task_status === 'SUCCEEDED') {
            videoUrl = res.data.output.video_url;
            break; // 如果状态为 SUCCEEDED,则跳出循环
          } else if (res.data.output.task_status === 'FAILED' || res.data.output.task_status === 'CANCELLED') {
            throw res.data.output.task_status; // 如果状态为 FAILED 或 CANCELLED,则抛出错误
          }
          // 如果状态不是 SUCCEEDED,则等待一段时间后继续轮询
          await new Promise(resolve => setTimeout(resolve, pollingInterval));
          retries++;
        } catch (err: any) {
          throw err.response?.data || err.message;  
        }
      }
    
      if (!videoUrl) {
        throw new Error('视频生成任务超时或失败');
      }
    
      return videoUrl;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets' results, implying a read-only operation, but doesn't describe key behaviors: whether it polls for completion, returns partial results, has rate limits, requires authentication, or what happens if the task_id is invalid. This leaves significant gaps for a tool that likely interacts with an async API.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (likely involving async video generation results), lack of annotations, no output schema, and 0% schema description coverage, the description is insufficient. It doesn't explain the return format (e.g., video URL, status), error conditions, or behavioral nuances, leaving the agent with inadequate information to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description doesn't mention parameters, and schema description coverage is 0% (no descriptions for the 'task_id' parameter). However, with only one parameter, the baseline is higher. The description implies a 'task_id' is needed to retrieve results, adding minimal context beyond the schema's structure, but doesn't explain what a task_id is or where to get it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('获取' meaning 'get' or 'retrieve') and the resource ('文生视频结果' meaning 'text-to-video generation result'), specifying it's for the Alibaba Cloud Wanx model. It distinguishes from the sibling 'wanx-t2v-video-generation' (which likely initiates generation) by focusing on result retrieval, though it doesn't explicitly mention this distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a task_id from a prior generation request), when not to use it, or how it relates to sibling tools like 'wanx-t2v-video-generation' (presumably for initiating generation). Usage is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Suixinlei/tongyi-wanx-mcp-server'

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