Skip to main content
Glama
easyhak

YouTube Search & Download MCP Server

by easyhak

get_video_info

Retrieve detailed metadata for YouTube videos including description, tags, and statistics by providing the video ID. Supports JSON or Markdown output formats.

Instructions

Get detailed information about a specific YouTube video.

Args: video_id: YouTube video ID (11 characters, e.g., "dQw4w9WgXcQ") output_format: Output format - "json" or "markdown" (default: "json")

Returns: Detailed video information including description, tags, and statistics

Example: get_video_info("dQw4w9WgXcQ", output_format="markdown")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYes
output_formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the 'get_video_info' MCP tool, which validates the video ID, fetches details from the search provider, and formats the response.
    @mcp.tool()
    async def get_video_info(video_id: str, output_format: str = "json") -> str:
        """
        Get detailed information about a specific YouTube video.
    
        Args:
            video_id: YouTube video ID (11 characters, e.g., "dQw4w9WgXcQ")
            output_format: Output format - "json" or "markdown" (default: "json")
    
        Returns:
            Detailed video information including description, tags, and statistics
    
        Example:
            get_video_info("dQw4w9WgXcQ", output_format="markdown")
        """
        try:
            logger.info(f"Get video info request: video_id='{video_id}'")
    
            # Validate video ID
            if not validate_video_id(video_id):
                raise InvalidQueryError(f"Invalid video ID format: {video_id}")
    
            # Get video details
            provider = get_search_provider()
            details = await provider.get_video_details(video_id)
    
            # Format results
            formatter = get_formatter(output_format)
            result = formatter.format_video_details(details)
    
            logger.info(f"Retrieved info for: {details.title}")
            return result
    
        except InvalidQueryError as e:
            logger.warning(f"Invalid video ID: {e.message}")
            return json.dumps({"error": "invalid_video_id", "message": e.message})
        except VideoNotFoundError as e:
            logger.warning(f"Video not found: {e.message}")
            return json.dumps(
                {"error": "video_not_found", "message": "Video not found or unavailable."}
            )
        except NetworkError as e:
            logger.error(f"Network error: {e.message}")
            return json.dumps(
                {
                    "error": "network_error",
                    "message": "Failed to connect to YouTube.",
                    "details": e.message,
                }
            )
        except Exception:
            logger.exception("Unexpected error in get_video_info")
            return json.dumps(
                {"error": "internal_error", "message": "An unexpected error occurred."}
            )
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 returns 'detailed video information' but doesn't specify what happens with invalid video IDs, rate limits, authentication requirements, or API constraints. The example shows usage but lacks operational context.

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

Conciseness4/5

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

The description is well-structured with clear sections (Args, Returns, Example) and front-loaded purpose. The example is helpful but could be more concise. Overall efficient with minimal waste.

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 the tool has an output schema (which handles return values), the description provides adequate context for a read-only operation. It covers purpose, parameters, and basic usage, though could benefit from more behavioral details given the lack of annotations.

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 0%, so the description must compensate. It provides clear semantics for both parameters: video_id specifies the format (11 characters with example) and output_format explains the two options with default. This adds significant value beyond the bare schema.

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?

The description clearly states the verb 'Get' and resource 'detailed information about a specific YouTube video', making the purpose explicit. It distinguishes from siblings like download_audio/video (which fetch content) and get_playlist_info (which focuses on playlists).

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 usage when detailed video metadata is needed, but provides no explicit guidance on when to use this versus alternatives like search_videos or validate_provider. No when-not-to-use or prerequisite information is included.

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

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