Skip to main content
Glama

find_video_path

Locate the exact file path of a video by recursively searching a specified directory. Input the root directory and video file name (with or without extension) to retrieve the first matching video's full path or an empty string if not found.

Instructions

可以查找视频文件路径,查找文件路径,递归查找精确匹配文件名的视频文件路径(支持带或不带扩展名) 参数: root_path - 要搜索的根目录 video_name - 视频文件名(可以带扩展名,但会忽略扩展名匹配) 返回: 首个匹配的视频文件完整路径,找不到时返回空字符串

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
root_pathYes
video_nameYes

Implementation Reference

  • The @mcp.tool() decorator registers the 'find_video_path' tool with the FastMCP server.
    @mcp.tool()
  • Implements the tool logic: recursively walks the directory tree starting from root_path to find the first video file whose stem matches video_name (case-insensitive), checking against common video extensions, and returns the full path or empty string if not found.
    def find_video_path(root_path, video_name): """ 可以查找视频文件路径,查找文件路径,递归查找精确匹配文件名的视频文件路径(支持带或不带扩展名) 参数: root_path - 要搜索的根目录 video_name - 视频文件名(可以带扩展名,但会忽略扩展名匹配) 返回: 首个匹配的视频文件完整路径,找不到时返回空字符串 """ VIDEO_EXTS = {'.mp4', '.avi', '.mov', '.mkv', '.flv', '.wmv', '.webm', '.ts'} target_stem, target_ext = os.path.splitext(video_name) if target_ext.lower() not in VIDEO_EXTS: target_stem = f"{target_stem}{target_ext}" target_ext = "" for root, dirs, files in os.walk(root_path): for file in files: stem, ext = os.path.splitext(file) if stem.lower() == target_stem.lower(): if (not target_ext or ext.lower() in VIDEO_EXTS): return os.path.join(root, file) return ""

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/video-creator/ffmpeg-mcp'

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