Skip to main content
Glama

get_thumbnail_url

Generate thumbnail URLs for Kaltura videos to display previews, create galleries, or show video cards. Specify dimensions and capture frames from any timestamp.

Instructions

Get video THUMBNAIL/POSTER image. USE WHEN: Displaying video previews, creating galleries, showing video cards, generating custom thumbnails. RETURNS: Image URL with your specified size. EXAMPLES: 'Get thumbnail for video 1_abc123', 'Create 400x300 preview image', 'Get frame from 30 seconds in'. Can capture any frame from video.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entry_idYesVideo to get thumbnail from (format: '1_abc123')
widthNoThumbnail width in pixels (default: 120)
heightNoThumbnail height in pixels (default: 90)
secondNoVideo timestamp in seconds to capture (default: 5)

Implementation Reference

  • The main handler function that executes the get_thumbnail_url tool. It validates inputs, retrieves the media entry, constructs a custom thumbnail URL based on width, height, and timestamp parameters, and returns JSON with the result.
    async def get_thumbnail_url(
        manager: KalturaClientManager,
        entry_id: str,
        width: int = 120,
        height: int = 90,
        second: int = 5,
    ) -> str:
        """Get thumbnail URL for a media entry with custom dimensions."""
        if not validate_entry_id(entry_id):
            return json.dumps({"error": "Invalid entry ID format"}, indent=2)
    
        # Validate numeric parameters
        if width <= 0 or width > 4096 or height <= 0 or height > 4096:
            return json.dumps(
                {"error": "Invalid dimensions: width and height must be between 1 and 4096"}, indent=2
            )
    
        if second < 0:
            return json.dumps({"error": "Invalid second parameter: must be non-negative"}, indent=2)
    
        try:
            client = manager.get_client()
        except Exception as e:
            return handle_kaltura_error(e, "get thumbnail URL", {"entry_id": entry_id})
    
        # Get the entry to verify it exists
        entry = client.media.get(entry_id)
    
        # Build thumbnail URL with parameters
        base_url = entry.thumbnailUrl
        if not base_url:
            return json.dumps(
                {
                    "error": "No thumbnail available for this entry",
                    "entryId": entry_id,
                }
            )
    
        # Add parameters for custom thumbnail
        params = []
        if width:
            params.append(f"width={width}")
        if height:
            params.append(f"height={height}")
        if second and entry.mediaType == KalturaMediaType.VIDEO:
            params.append(f"vid_sec={second}")
    
        # Construct URL
        if params:
            separator = "&" if "?" in base_url else "?"
            thumbnail_url = base_url + separator + "&".join(params)
        else:
            thumbnail_url = base_url
    
        return json.dumps(
            {
                "entryId": entry_id,
                "entryName": entry.name,
                "mediaType": safe_serialize_kaltura_field(entry.mediaType),
                "thumbnailUrl": thumbnail_url,
                "width": width,
                "height": height,
                "second": second if entry.mediaType == KalturaMediaType.VIDEO else None,
            },
            indent=2,
        )
  • Registers the 'get_thumbnail_url' tool with the MCP server in the list_tools() function. Includes the tool name, detailed description, and input schema for validation.
    types.Tool(
        name="get_thumbnail_url",
        description="Get video THUMBNAIL/POSTER image. USE WHEN: Displaying video previews, creating galleries, showing video cards, generating custom thumbnails. RETURNS: Image URL with your specified size. EXAMPLES: 'Get thumbnail for video 1_abc123', 'Create 400x300 preview image', 'Get frame from 30 seconds in'. Can capture any frame from video.",
        inputSchema={
            "type": "object",
            "properties": {
                "entry_id": {
                    "type": "string",
                    "description": "Video to get thumbnail from (format: '1_abc123')",
                },
                "width": {
                    "type": "integer",
                    "description": "Thumbnail width in pixels (default: 120)",
                },
                "height": {
                    "type": "integer",
                    "description": "Thumbnail height in pixels (default: 90)",
                },
                "second": {
                    "type": "integer",
                    "description": "Video timestamp in seconds to capture (default: 5)",
                },
            },
            "required": ["entry_id"],
        },
    ),
  • Defines the input schema for the get_thumbnail_url tool, specifying parameters like entry_id (required), width, height, and second with types and descriptions.
    inputSchema={
        "type": "object",
        "properties": {
            "entry_id": {
                "type": "string",
                "description": "Video to get thumbnail from (format: '1_abc123')",
            },
            "width": {
                "type": "integer",
                "description": "Thumbnail width in pixels (default: 120)",
            },
            "height": {
                "type": "integer",
                "description": "Thumbnail height in pixels (default: 90)",
            },
            "second": {
                "type": "integer",
                "description": "Video timestamp in seconds to capture (default: 5)",
            },
        },
        "required": ["entry_id"],
    },
  • Dispatches calls to the get_thumbnail_url handler function in the server's call_tool method.
    elif name == "get_thumbnail_url":
        result = await get_thumbnail_url(kaltura_manager, **arguments)
  • Re-exports the get_thumbnail_url function from media.py for use in other modules like server.py.
        get_download_url,
        get_media_entry,
        get_thumbnail_url,
        list_media_entries,
    )
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns an image URL, allows size specification, and can capture frames from any timestamp. However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions, which would be helpful for a tool with no annotation coverage.

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 (purpose, usage, returns, examples) and is appropriately sized. However, the examples could be more concise, and some phrasing ('Can capture any frame from video') is slightly redundant with earlier content, preventing a perfect score.

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's moderate complexity (4 parameters, no output schema, no annotations), the description is largely complete. It covers purpose, usage, returns, and examples, but lacks details on output format beyond 'Image URL' and doesn't address error handling or constraints, which would enhance completeness for a tool with no structured output or annotations.

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 description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'specified size' and 'any frame from video', which align with width/height and second parameters but don't provide additional semantic context. This meets the baseline for high schema 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's purpose with specific verbs ('Get video THUMBNAIL/POSTER image') and distinguishes it from siblings by focusing on thumbnail generation rather than analytics, content retrieval, or listing operations. It explicitly identifies the resource (video thumbnail) and the action (get).

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with a 'USE WHEN:' section listing scenarios like displaying previews, creating galleries, and generating custom thumbnails. It distinguishes from siblings by focusing on visual preview needs rather than data analysis or content access, though it doesn't name specific alternatives.

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/zoharbabin/kaltura-mcp'

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