Skip to content

feat(mcp): new tool modelstudio_video_to_video_wan26_submit_task in w…#64

Open
lether wants to merge 1 commit intoagentscope-ai:mainfrom
lether:feat/new-tool-wan2.6-r2v
Open

feat(mcp): new tool modelstudio_video_to_video_wan26_submit_task in w…#64
lether wants to merge 1 commit intoagentscope-ai:mainfrom
lether:feat/new-tool-wan2.6-r2v

Conversation

@lether
Copy link
Copy Markdown
Contributor

@lether lether commented Jan 20, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @lether, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the system's capabilities by introducing a new asynchronous video-to-video generation tool. This tool allows for the submission of video synthesis tasks to an external AI service, specifically Alibaba Cloud's Tongyi Wanxiang, to generate new video content using reference video characters. The integration provides a structured interface for defining video generation parameters and returns a unique identifier for tracking the progress of each submitted task.

Highlights

  • New Asynchronous Video-to-Video Generation Tool: Introduced a new component, VideoToVideoW26Submit, designed for asynchronous video generation tasks.
  • Alibaba Cloud Tongyi Wanxiang Integration: This new tool integrates with Alibaba Cloud's Tongyi Wanxiang (wan2.6-r2v) model, enabling the creation of new videos based on character images from provided reference videos.
  • Service Exposure: The VideoToVideoW26Submit tool is now exposed and available under the modelstudio_wan26 service within the McpServerMeta configuration.
  • Asynchronous Task Submission: The tool facilitates asynchronous task submission to the video synthesis API, returning a task_id for subsequent status queries and tracking.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Jan 20, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new component modelstudio_video_to_video_wan26_submit_task for submitting video-to-video generation tasks to the Wanxiang 2.6 model. The changes include adding the new component file, registering it in the __init__.py, and updating the component list for modelstudio_wan26_media.

The implementation of the new component is well-structured. I've provided a few suggestions to improve the code's robustness and maintainability, such as making the API response parsing safer and simplifying the construction of the request payload. I also pointed out a minor issue with an unused import.

Comment on lines +143 to +144
response_json = await resp.json()
task_id = response_json["output"]["task_id"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Direct dictionary access like response_json["output"]["task_id"] is not robust. If the API returns an unexpected JSON structure (e.g., an error message), this will raise a KeyError. It's also possible that resp.json() fails if the response is not valid JSON. It's better to wrap this logic in a try...except block to handle potential KeyError and json.JSONDecodeError gracefully.

                try:
                    response_json = await resp.json()
                    task_id = response_json["output"]["task_id"]
                except (KeyError, json.JSONDecodeError):
                    text = await resp.text()
                    raise RuntimeError(
                        f"Failed to parse task_id from API response: {text}",
                    )

import uuid
import json
from http import HTTPStatus
from typing import Any, Optional, Dict
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Dict is imported from typing but is not used in this file. It's best to remove unused imports to keep the code clean.

Suggested change
from typing import Any, Optional, Dict
from typing import Any, Optional

Comment on lines +102 to +115
input_data = {
"prompt": args.prompt,
"reference_video_urls": args.reference_video_urls,
}
if args.negative_prompt is not None:
input_data["negative_prompt"] = args.negative_prompt
parameters = {
"size": args.size,
"duration": args.duration,
"shot_type": args.shot_type,
"watermark": args.watermark,
}
if args.seed is not None:
parameters["seed"] = args.seed
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The construction of input_data and parameters can be simplified and made more maintainable by using pydantic's model_dump method. This avoids manually listing each parameter and will automatically handle new parameters added to the input model, reducing the chance of errors.

        all_args = args.model_dump(exclude={"ctx"}, exclude_none=True)
        input_fields = {"prompt", "reference_video_urls", "negative_prompt"}

        input_data = {k: v for k, v in all_args.items() if k in input_fields}
        parameters = {k: v for k, v in all_args.items() if k not in input_fields}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant