Skip to main content
Glama

list_caption_assets

Check if a video has captions or subtitles and list available languages and formats to prepare for accessibility or transcript use.

Instructions

Find all CAPTIONS/SUBTITLES for a video. USE WHEN: Checking if video has captions, finding available languages, preparing for accessibility, getting transcript. RETURNS: List of caption files with languages, formats (SRT/VTT), IDs. EXAMPLE: 'Does video 1_abc123 have captions?', 'List subtitle languages available'. First step before getting caption content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entry_idYesVideo to check for captions (format: '1_abc123')

Implementation Reference

  • The main handler function that executes the list_caption_assets tool logic, querying the Kaltura API for caption assets associated with a media entry ID.
    async def list_caption_assets(
        manager: KalturaClientManager,
        entry_id: str,
    ) -> str:
        """List all caption assets for a media entry."""
        if not validate_entry_id(entry_id):
            return json.dumps({"error": "Invalid entry ID format"}, indent=2)
    
        if not CAPTION_AVAILABLE:
            return json.dumps(
                {
                    "error": "Caption functionality is not available. The Caption plugin is not installed.",
                    "entryId": entry_id,
                },
                indent=2,
            )
    
        client = manager.get_client()
    
        try:
            # Create filter for caption assets
            filter = KalturaCaptionAssetFilter()
            filter.entryIdEqual = entry_id
    
            # List caption assets
            result = client.caption.captionAsset.list(filter)
    
            captions = []
            for caption in result.objects:
                caption_data = {
                    "id": getattr(caption, "id", None),
                    "entryId": getattr(caption, "entryId", None),
                    "language": safe_serialize_kaltura_field(getattr(caption, "language", None)),
                    "languageCode": safe_serialize_kaltura_field(
                        getattr(caption, "languageCode", None)
                    ),
                    "label": getattr(caption, "label", None),
                    "format": safe_serialize_kaltura_field(getattr(caption, "format", None)),
                    "status": safe_serialize_kaltura_field(getattr(caption, "status", None)),
                    "fileExt": getattr(caption, "fileExt", None),
                    "size": getattr(caption, "size", None),
                    "createdAt": datetime.fromtimestamp(caption.createdAt).isoformat()
                    if caption.createdAt
                    else None,
                    "updatedAt": datetime.fromtimestamp(caption.updatedAt).isoformat()
                    if caption.updatedAt
                    else None,
                    "accuracy": getattr(caption, "accuracy", None),
                    "isDefault": safe_serialize_kaltura_field(getattr(caption, "isDefault", None)),
                }
                captions.append(caption_data)
    
            return json.dumps(
                {
                    "entryId": entry_id,
                    "totalCount": result.totalCount,
                    "captionAssets": captions,
                },
                indent=2,
            )
    
        except Exception as e:
            return handle_kaltura_error(e, "list caption assets", {"entryId": entry_id})
  • MCP tool schema definition including input schema (entry_id required) and usage description.
    types.Tool(
        name="list_caption_assets",
        description="Find all CAPTIONS/SUBTITLES for a video. USE WHEN: Checking if video has captions, finding available languages, preparing for accessibility, getting transcript. RETURNS: List of caption files with languages, formats (SRT/VTT), IDs. EXAMPLE: 'Does video 1_abc123 have captions?', 'List subtitle languages available'. First step before getting caption content.",
        inputSchema={
            "type": "object",
            "properties": {
                "entry_id": {
                    "type": "string",
                    "description": "Video to check for captions (format: '1_abc123')",
                },
            },
            "required": ["entry_id"],
        },
    ),
  • Tool handler registration and dispatch in the MCP server's call_tool method.
    elif name == "list_caption_assets":
        result = await list_caption_assets(kaltura_manager, **arguments)
  • Import and export of the list_caption_assets function in the tools module for use across the package.
    from .assets import (
        get_attachment_content,
        get_caption_content,
        list_attachment_assets,
        list_caption_assets,
    )

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