Skip to main content
Glama

get_download_url

Generate time-limited secure URLs to download video files from Kaltura for local saving, editing, backups, or sharing downloadable links.

Instructions

Get direct DOWNLOAD link for video files. USE WHEN: User needs to download/save video locally, export for editing, backup content, share downloadable link. RETURNS: Time-limited secure URL for downloading. EXAMPLE: 'Download video 1_abc123', 'Get mp4 file for editing'. Different from streaming - this is for saving files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entry_idYesVideo to download (format: '1_abc123')
flavor_idNoOptional: Choose specific quality/format. Leave empty for default. Use list_media_entries to see available flavors.

Implementation Reference

  • The async handler function implementing the get_download_url tool logic: validates entry_id, fetches media entry, selects flavor asset (specific or original), generates and returns download URL with metadata in JSON format.
    async def get_download_url(
        manager: KalturaClientManager,
        entry_id: str,
        flavor_id: Optional[str] = None,
    ) -> str:
        """Get a direct download URL for a media entry."""
        if not validate_entry_id(entry_id):
            return json.dumps({"error": "Invalid entry ID format"}, indent=2)
    
        try:
            client = manager.get_client()
    
            # Get the entry to verify it exists
            entry = client.media.get(entry_id)
        except Exception as e:
            return handle_kaltura_error(e, "get download URL", {"entry_id": entry_id})
    
        # Get flavor assets
        flavor_filter = KalturaAssetFilter()
        flavor_filter.entryIdEqual = entry_id
        flavors = client.flavorAsset.list(flavor_filter)
    
        if flavor_id:
            # Find specific flavor
            target_flavor = None
            for flavor in flavors.objects:
                if flavor.id == flavor_id:
                    target_flavor = flavor
                    break
            if not target_flavor:
                return json.dumps({"error": f"Flavor ID {flavor_id} not found for entry {entry_id}"})
        else:
            # Get the source or highest quality flavor
            target_flavor = None
            for flavor in flavors.objects:
                if flavor.isOriginal:
                    target_flavor = flavor
                    break
            if not target_flavor and flavors.objects:
                target_flavor = flavors.objects[0]
    
        if not target_flavor:
            return json.dumps({"error": "No flavor assets found for this entry"})
    
        # Get download URL
        download_url = client.flavorAsset.getUrl(target_flavor.id)
    
        return json.dumps(
            {
                "entryId": entry_id,
                "entryName": entry.name,
                "flavorId": target_flavor.id,
                "fileSize": target_flavor.size * 1024
                if target_flavor.size
                else None,  # Convert KB to bytes
                "bitrate": target_flavor.bitrate,
                "format": target_flavor.fileExt,
                "downloadUrl": download_url,
            },
            indent=2,
        )
  • Defines the tool schema, description, and input parameters (entry_id required, flavor_id optional) for registration in MCP server's list_tools().
    types.Tool(
        name="get_download_url",
        description="Get direct DOWNLOAD link for video files. USE WHEN: User needs to download/save video locally, export for editing, backup content, share downloadable link. RETURNS: Time-limited secure URL for downloading. EXAMPLE: 'Download video 1_abc123', 'Get mp4 file for editing'. Different from streaming - this is for saving files.",
        inputSchema={
            "type": "object",
            "properties": {
                "entry_id": {
                    "type": "string",
                    "description": "Video to download (format: '1_abc123')",
                },
                "flavor_id": {
                    "type": "string",
                    "description": "Optional: Choose specific quality/format. Leave empty for default. Use list_media_entries to see available flavors.",
                },
            },
            "required": ["entry_id"],
        },
    ),
  • Dispatches calls to the get_download_url handler function in the MCP server's call_tool method.
    elif name == "get_download_url":
        result = await get_download_url(kaltura_manager, **arguments)
  • Registers/exports the get_download_url function from media.py module for import in server.py.
    from .media import (
        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 reveals key traits: the tool returns a 'Time-limited secure URL' (implying expiration and authentication needs) and is for 'saving files' (clarifying the download intent). However, it doesn't mention rate limits, error conditions, or file size considerations.

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 efficiently structured with clear sections (purpose, usage guidelines, returns, examples, differentiation) in just four sentences. Every sentence adds value: the first states the core function, the second provides usage context, the third describes the return value, and the fourth gives examples and differentiation.

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?

For a tool with no annotations and no output schema, the description does well by explaining the return value ('Time-limited secure URL') and providing usage guidance. However, it could be more complete by detailing the URL's expiration timeframe or error cases, given the mutation-like nature of generating download links.

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 fully documents both parameters (entry_id format, flavor_id optionality and purpose). The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3 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 specific action ('Get direct DOWNLOAD link') and resource ('for video files'), distinguishing it from sibling tools like get_thumbnail_url (thumbnails) or get_media_entry (metadata). It explicitly contrasts with 'streaming' to clarify this is for saving files, not playback.

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 includes an explicit 'USE WHEN:' section listing four concrete scenarios (download/save locally, export for editing, backup content, share downloadable link) and provides two examples. It also differentiates from streaming, giving clear context for when to choose this tool over 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