Skip to main content
Glama

ask_about_youtube_video

Get answers to questions about YouTube video content or receive a general description of the video.

Instructions

Answers a question about the video or provides a general description if no question is asked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
youtube_urlYes
questionNoQuestion about the video content. If omitted, a general description will be generated.

Implementation Reference

  • Implements the handler logic for the 'ask_about_youtube_video' tool. Parses input arguments using the schema, constructs a prompt (question-specific or general description), calls the shared Gemini API helper with the YouTube video, and handles success/error responses including Zod validation.
    case "ask_about_youtube_video": {
      // Define question variable outside try block to access in catch
      let question: string | undefined;
      try {
        // Parse and validate arguments
        const args = AskAboutYoutubeVideoInputSchema.parse(request.params.arguments);
        const { youtube_url } = args;
        question = args.question; // Assign parsed question here
    
          console.error(`[INFO] Received request for ask_about_youtube_video: ${youtube_url}`);
    
          let finalPrompt: string;
          if (question) {
            // If a question is provided, use the Q&A prompt
            console.error(`[INFO] Question: "${question}"`);
            finalPrompt = `Please answer the following question based on the provided video content:\n\nQuestion: ${question}`;
          } else {
            // If no question, use a general description prompt
            console.error(`[INFO] No question provided, generating general description.`);
            finalPrompt = "Describe this video content in detail.";
          }
    
          // Call Gemini API using the helper function
          const answerOrDescription = await callGeminiApi(finalPrompt, {
            mimeType: "video/youtube",
            fileUri: youtube_url,
          });
    
          console.error(`[INFO] Successfully generated response (answer or description).`);
          // Return success response
          return {
            content: [{ type: "text", text: answerOrDescription }],
          };
    
        } catch (error: any) {
          console.error(`[ERROR] Failed during ask_about_youtube_video tool execution:`, error);
    
          // Handle Zod validation errors
          if (error instanceof z.ZodError) {
            return {
              content: [{ type: "text", text: `Invalid input: ${JSON.stringify(error.errors)}` }],
              isError: true,
            };
          }
    
          // Handle generic errors
          let errorMessage = question ? `Failed to answer the question based on the video.` : `Failed to generate description for the video.`;
          if (error.message) {
            errorMessage += ` Details: ${error.message}`;
          }
          return {
            content: [{ type: "text", text: errorMessage }],
            isError: true,
          };
        }
      }
  • Zod input schema definition for the 'ask_about_youtube_video' tool, validating youtube_url as a URL and question as optional string.
    const AskAboutYoutubeVideoInputSchema = z.object({
      youtube_url: z.string().url({ message: "Invalid YouTube URL provided." }),
      // Making question optional to handle general description requests as well
      question: z.string().optional().describe("Question about the video content. If omitted, a general description will be generated."),
    });
  • src/index.ts:76-80 (registration)
    Registers the 'ask_about_youtube_video' tool in the ListTools response, providing name, description, and converted JSON schema.
    {
      name: "ask_about_youtube_video",
      description: "Answers a question about the video or provides a general description if no question is asked.",
      inputSchema: zodToJsonSchema(AskAboutYoutubeVideoInputSchema), // Schema updated to make question optional
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool can answer questions or provide descriptions, but doesn't cover important aspects like rate limits, authentication needs, error conditions, or what constitutes a 'general description.' This leaves significant gaps for a tool that presumably processes external content.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately sized for a tool with two parameters and front-loads the essential information about what the tool does.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides basic purpose and parameter guidance but lacks sufficient detail about behavioral traits, error handling, or output format. For a tool that interacts with external video content, more context about limitations or capabilities would be helpful to achieve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (only the question parameter has a description). The description adds valuable context by explaining that omitting the question parameter triggers a general description, which clarifies the optional nature and default behavior. This compensates well for the schema's partial coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: answering questions about YouTube videos or providing general descriptions. It specifies the verb ('answers'/'provides') and resource ('video'), but doesn't explicitly differentiate from sibling tools like summarize_youtube_video or extract_key_moments, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool (for questions about video content or general descriptions) but doesn't provide explicit guidance on when to choose alternatives like summarize_youtube_video or extract_key_moments. No exclusions or prerequisites are mentioned, leaving usage context somewhat vague.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/minbang930/Youtube-Vision-MCP'

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