Skip to main content
Glama

list_transcripts

Retrieve available transcript languages for a YouTube video by providing its URL or video ID.

Instructions

List available transcript languages for a YouTube video.

Args: url: YouTube video URL or video ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:524-547 (handler)
    Tool registration and handler for 'list_transcripts'. Uses @mcp.tool() decorator. Extracts video ID, calls api.list(video_id) to get available transcripts, and formats each transcript's language, code, type (auto-generated/manual), and translatability.
    @mcp.tool()
    def list_transcripts(url: str) -> str:
        """List available transcript languages for a YouTube video.
    
        Args:
            url: YouTube video URL or video ID
        """
        try:
            video_id = extract_video_id(url)
        except ValueError as e:
            return f"Error: {e}"
    
        try:
            transcript_list = api.list(video_id)
            lines = [f"Available transcripts for video '{video_id}':\n"]
            for t in transcript_list:
                kind = "auto-generated" if t.is_generated else "manual"
                translatable = "translatable" if t.is_translatable else "not translatable"
                lines.append(f"  - {t.language} ({t.language_code}) [{kind}, {translatable}]")
            if len(lines) == 1:
                return f"No transcripts found for video '{video_id}'."
            return "\n".join(lines)
        except Exception as e:
            return _handle_transcript_error(e, video_id, None)
  • main.py:524-524 (registration)
    The @mcp.tool() decorator on line 524 registers 'list_transcripts' as an MCP tool with FastMCP server 'youtube-summary'.
    @mcp.tool()
  • main.py:40-63 (helper)
    extract_video_id helper used by list_transcripts to parse video ID from URLs or bare IDs.
    def extract_video_id(url_or_id: str) -> str:
        """Extract a YouTube video ID from a URL or bare ID string."""
        url_or_id = url_or_id.strip()
        if BARE_ID_REGEX.match(url_or_id):
            return url_or_id
        match = VIDEO_ID_REGEX.search(url_or_id)
        if match:
            return match.group(1)
        raise ValueError(
            f"Could not extract a YouTube video ID from: {url_or_id}"
        )
    
    
    def extract_playlist_id(url_or_id: str) -> str:
        """Extract a YouTube playlist ID from a URL or bare ID string."""
        s = url_or_id.strip()
        if BARE_PLAYLIST_ID_REGEX.match(s):
            return s
        match = PLAYLIST_LIST_PARAM_REGEX.search(s)
        if match:
            return match.group(1)
        raise ValueError(
            f"Could not extract a YouTube playlist ID from: {url_or_id}"
        )
  • _handle_transcript_error helper used by list_transcripts and other tools to convert youtube_transcript_api exceptions to user-friendly error messages.
    def _handle_transcript_error(e: Exception, video_id: str, languages: list[str] | None = None) -> str:
        """Convert youtube_transcript_api exceptions into user-friendly error strings."""
        from youtube_transcript_api import (
            AgeRestricted,
            InvalidVideoId,
            IpBlocked,
            NoTranscriptFound,
            RequestBlocked,
            TranscriptsDisabled,
            VideoUnavailable,
        )
    
        if isinstance(e, TranscriptsDisabled):
            return f"Error: Transcripts are disabled for video '{video_id}'."
        if isinstance(e, NoTranscriptFound):
            lang_str = ", ".join(languages) if languages else "any"
            return (
                f"Error: No transcript found for video '{video_id}' "
                f"in language(s): {lang_str}. Use list_transcripts to see available languages."
            )
        if isinstance(e, VideoUnavailable):
            return f"Error: Video '{video_id}' is unavailable."
        if isinstance(e, InvalidVideoId):
            return f"Error: '{video_id}' is not a valid YouTube video ID."
        if isinstance(e, AgeRestricted):
            return f"Error: Video '{video_id}' is age-restricted and cannot be accessed."
        if isinstance(e, IpBlocked):
            return "Error: YouTube is blocking requests from this IP address."
        if isinstance(e, RequestBlocked):
            return "Error: The request to YouTube was blocked."
        return f"Error fetching transcript for '{video_id}': {e}"
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It omits any information about read-only nature, error handling, authentication needs, or side effects. For a listing tool, basic safety context is missing.

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 concise with two short sentences. It is front-loaded with the main action. The parameter documentation is separate but minimal. No wasted words.

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 the presence of an output schema, the description does not need to detail return values. However, it lacks context on prerequisites (e.g., video must exist) and does not guide the agent on when to use this vs. get_transcript. For a simple tool, this is adequate but not comprehensive.

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?

The description adds meaning beyond the input schema by specifying that the url parameter accepts 'YouTube video URL or video ID', which the schema lacks. This clarifies acceptable input formats despite the 0% schema description coverage.

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 tool lists available transcript languages for a YouTube video. This verb+resource phrasing distinguishes it from sibling tools like get_transcript (retrieves a specific transcript) and get_video_metadata (metadata).

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 for discovering transcript languages before fetching one, but it does not explicitly state when to use this tool versus alternatives like get_transcript or provide any when-not-to-use guidance.

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/zlatkoc/youtube-summarize'

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