> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veadk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 视频云 MCP

## 功能说明

`vod_tools`（`from veadk.tools.builtin_tools.vod import vod_tools`）通过火山引擎视频云 MCP 进行视频剪辑处理，详见 [VOD MCP Server](https://github.com/volcengine/mcp-server/blob/main/server/mcp_server_vod/README_zh.md)。

## 环境变量与前提

<Warning>
  附加要求：

  1. 配置火山引擎 AK / SK；
  2. （可选）通过 `TOOL_VOD_GROUPS` 选择能力组：`edit`、`intelligent_slicing`、`intelligent_matting`、`subtitle_processing`、`audio_processing`、`video_enhancement`、`upload`、`video_play`；多个用逗号连接，未配置时默认 `edit,video_play`；
  3. （可选）`TOOL_VOD_TIMEOUT` 工具连接超时时长，默认 10 秒；
  4. 视频云工具不支持创建 Space，请先在控制台创建[视频云空间](https://console.volcengine.com/vod/region:vod+cn-north-1/overview/)。
</Warning>

环境变量：

* `VOLCENGINE_ACCESS_KEY`：火山引擎 AccessKey
* `VOLCENGINE_SECRET_KEY`：火山引擎 SecretKey
* `TOOL_VOD_GROUPS`（可选）：能力组
* `TOOL_VOD_TIMEOUT`（可选）：连接超时时长，默认 10.0 秒

或在 `config.yaml` 中配置：

```yaml title="config.yaml" lines theme={null}
volcengine:
  access_key: your-access-key-here
  secret_key: your-secret-key-here
tool:
  vod:
    groups: edit,video_play
    timeout: 10.0
```

安装 `uv`，确认 `uvx --version` 可执行，并允许下载 VOD MCP Server 及依赖。视频需使用服务可访问的有效 URL，替换示例中的 URL 与已创建的 Space 名称；推理模型也需完成配置

## 使用方法

```python title="examples/tools/vod/agent.py" lines theme={null}
import asyncio

from veadk import Agent, Runner
from veadk.memory.short_term_memory import ShortTermMemory
from veadk.tools.builtin_tools.vod import vod_tools

agent = Agent(
    name="vod_agent",
    model_name="doubao-seed-2-1-pro-260628",
    description="A video editing assistant.",
    instruction="Use vod_tools to edit and process videos.",
    tools=[vod_tools],
)

runner = Runner(agent=agent, short_term_memory=ShortTermMemory())


async def main():
    response = await runner.run(
        "将这两个视频合并：<your-url1>, <your-url2>，space_name 为 <your-space-name>"
    )
    print(response)


if __name__ == "__main__":
    asyncio.run(main())
```

## 额外说明

<Note>
  有些视频编辑任务耗时较长，会直接返回一个 `task_id`。可以继续向智能体询问任务是否完成，从而获取后续结果。
</Note>

## 能力组与配置生效时机

| 能力组 | 用途 |
| :- | :- |
| `edit` | 视频编辑 |
| `intelligent_slicing` | 智能切片 |
| `intelligent_matting` | 智能抠像 |
| `subtitle_processing` | 字幕处理 |
| `audio_processing` | 音频处理 |
| `video_enhancement` | 视频增强 |
| `upload` | 媒体上传 |
| `video_play` | 视频播放 |

在导入 `vod_tools` 前设置 `TOOL_VOD_GROUPS` 与 `TOOL_VOD_TIMEOUT`，也可使用上文 YAML 配置；VeADK 加载配置时将其转换为环境变量。修改后重新启动进程以重建工具连接。`timeout` 控制 MCP 连接等待，不是视频处理任务的完成时限。默认能力由 VOD MCP Server 提供，VeADK 未配置时不主动传入能力组

此内置连接启动火山引擎 VOD MCP Server。BytePlus 凭证的配置不代表该服务自动支持 BytePlus 端点，应使用与目标视频云服务匹配的 MCP 配置。返回 `task_id` 仅代表任务已提交，需继续查询到成功状态并取得结果地址后才算完成

## 验证连接

```python lines theme={null}
import asyncio

from veadk.tools.builtin_tools.vod import vod_tools


async def main():
    try:
        tools = await vod_tools.get_tools()
        print([tool.name for tool in tools])
    finally:
        await vod_tools.close()


if __name__ == "__main__":
    asyncio.run(main())
```
