File size: 1,089 Bytes
54b404a
d7f8c20
 
54b404a
 
5d6fe45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Your detailed YouTube analysis app.py content
import gradio as gr
from pytube import YouTube
# ... more of your code ...
youtube_tool_interface.launch(mcp_server=True)
# app.py
# ... (your imports and function definitions for analyze_youtube_content) ...

youtube_tool_interface = gr.Interface(
    fn=analyze_youtube_content,
    inputs=[
        gr.Textbox(label="YouTube Video URL (Optional)", placeholder="Enter YouTube video URL..."),
        gr.Textbox(label="Video Transcript Text (Optional)", placeholder="Paste video transcript here...", lines=5)
    ],
    outputs=gr.JSON(label="Analysis Result"),
    title="YouTube Content Analyzer Tool",
    description="Provides information and sentiment analysis for a YouTube video URL or its transcript. (For Agent Use via MCP)"
)

if __name__ == "__main__":
    logging.info("Launching Gradio app with MCP server enabled for the YouTube Content Analyzer Tool...")
    # The `mcp_server=True` flag is crucial for the agent to connect and use the tool.
    youtube_tool_interface.launch(mcp_server=True) # <<< MAKE SURE THIS IS CORRECT