Skip to main content
Glama

Get Video Details

videos_getVideo
Read-onlyIdempotent

Retrieve detailed information for a YouTube video by providing its video ID, including the video URL and optional specified data parts.

Instructions

Get detailed information about a YouTube video including URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
videoIdYesThe YouTube video ID
partsNoParts of the video to retrieve

Implementation Reference

  • Registration of the 'videos_getVideo' tool via McpServer.registerTool(). Includes inputSchema with videoId (required) and parts (optional), and the handler that delegates to videoService.getVideo().
    server.registerTool(
        'videos_getVideo',
        {
            title: 'Get Video Details',
            description: 'Get detailed information about a YouTube video including URL',
            annotations: { readOnlyHint: true, idempotentHint: true },
            inputSchema: {
                videoId: z.string().describe('The YouTube video ID'),
                parts: z.array(z.string()).optional().describe('Parts of the video to retrieve'),
            },
        },
        async ({ videoId, parts }) => {
            const result = await videoService.getVideo({ videoId, parts });
            return {
                content: [{
                    type: 'text',
                    text: JSON.stringify(result, null, 2)
                }]
            };
        }
    );
  • The getVideo() method on VideoService which is the actual implementation. Calls the YouTube Data API v3 videos.list endpoint with the provided parts and videoId, then structures the result with URL via createStructuredVideo().
    /**
     * Get detailed information about a YouTube video
     */
    async getVideo({
      videoId,
      parts = ['snippet', 'contentDetails', 'statistics']
    }: VideoParams): Promise<unknown> {
      try {
        this.initialize();
    
        const response = await this.youtube.videos.list({
          part: parts,
          id: [videoId]
        });
    
        const videoData = response.data.items?.[0] || null;
        return this.createStructuredVideo(videoData);
      } catch (error) {
        throw new Error(`Failed to get video: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The VideoParams interface defining the input parameters (videoId: string, parts?: string[]) used by videoService.getVideo().
    export interface VideoParams {
      videoId: string;
      parts?: string[];
    }
  • The createStructuredVideo() helper method that enriches raw video data with a YouTube watch URL (https://www.youtube.com/watch?v={videoId}) and extracts videoId.
    private createStructuredVideo(videoData: unknown): unknown {
      if (!videoData) return null;
    
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      const v = videoData as any;
      const videoId = v.id || v.id?.videoId;
      const url = videoId ? `https://www.youtube.com/watch?v=${videoId}` : null;
    
      return {
        ...v,
        url,
        videoId
      };
    }
Behavior3/5

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

Annotations already indicate readonly and idempotent. Description adds that the response includes URL, which is useful context, but does not disclose other behavioral traits like rate limits or permissions.

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?

Single sentence, front-loaded with action, no unnecessary words. Perfectly concise.

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

Completeness4/5

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

Given no output schema, the description provides some detail about the response (includes URL). However, it omits other possible response fields like statistics or metadata, which could be inferred from the 'parts' parameter. Still adequate for a simple get tool.

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

Parameters3/5

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

Schema descriptions already cover both parameters (videoId and parts) with 100% coverage. The description does not add additional parameter-level meaning beyond that.

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

Purpose5/5

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

Description uses specific verb 'Get' and resource 'detailed information about a YouTube video including URL', clearly distinguishing it from sibling tools like videos_searchVideos which searches for videos.

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

Usage Guidelines2/5

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

No guidance on when to use this vs alternatives (e.g., videos_searchVideos). Does not specify that it requires a known videoId, nor when not to use it.

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/sfiorini/youtube-mcp'

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