Skip to main content
Glama

show_video_tool

Extracts and saves specific video segments by defining document name, start time, and end time using the Video RAG MCP Server.

Instructions

Creates and saves a video chunk based on the document name, start time, and end time of the chunk. Returns a message indicating that the video chunk was created successfully. Args: document_name (str): The name of the document the chunk belongs to start_time (float): The start time of the chunk end_time (float): The end time of the chunk Returns: str: A message indicating that the video chunk was created successfully

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_nameYes
end_timeYes
start_timeYes

Implementation Reference

  • server.py:45-63 (handler)
    The primary handler for the 'show_video_tool' MCP tool. It is registered via the @mcp.tool() decorator and implements the tool logic by invoking the chunk_video helper function with the provided parameters.
    @mcp.tool() def show_video_tool(document_name: str, start_time: float, end_time: float) -> str: """ Creates and saves a video chunk based on the document name, start time, and end time of the chunk. Returns a message indicating that the video chunk was created successfully. Args: document_name (str): The name of the document the chunk belongs to start_time (float): The start time of the chunk end_time (float): The end time of the chunk Returns: str: A message indicating that the video chunk was created successfully """ try: chunk_video(document_name, start_time, end_time) return "Video chunk created successfully" except Exception as e: return f"Failed to create video chunk: {str(e)}"
  • Helper function that performs the actual video chunking using moviepy.VideoFileClip. Extracts a clip from the video file located at videos/{document_name} between start_time and end_time, and saves it to video_chunks/.
    def chunk_video(document_name, start_time, end_time, directory="videos"): # Create output filename output_dir = Path("video_chunks") output_dir.mkdir(parents=True, exist_ok=True) chunk_filename = f"video_chunk_{start_time:.1f}_{end_time:.1f}.mp4" output_path = output_dir / chunk_filename with VideoFileClip(directory + "/" + document_name) as video: video_duration = video.duration actual_end_time = min(end_time, video_duration) if end_time is not None else video_duration video_chunk = video.subclipped(start_time, actual_end_time) video_chunk.write_videofile(str(output_path)) return output_path

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/FiloHany/Video_RAG_MCP'

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