Skip to main content
Glama

get_realtime_metrics

Monitor live streaming analytics updated every 30 seconds to track active viewers, plays per minute, and bandwidth usage for real-time event monitoring and issue detection.

Instructions

Get LIVE analytics updating every 30 seconds. USE WHEN: Monitoring live events/streams, building real-time dashboards, tracking immediate campaign impact, detecting issues as they happen. RETURNS: Current active viewers, plays per minute, bandwidth usage. EXAMPLES: 'How many people watching right now?', 'Monitor live event performance', 'Track viral video in real-time'. Different from historical analytics - this is NOW.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_typeNoWhat to monitor (default: 'viewers'): 'viewers' = active viewer count, 'geographic' = viewer locations, 'quality' = streaming performance/buffering.
entry_idNoOptional entry ID for content-specific metrics

Implementation Reference

  • The primary handler function for the get_realtime_metrics tool. Maps user-friendly report types to Kaltura API types, calls the core analytics function, adds a current timestamp, and returns formatted JSON response.
    async def get_realtime_metrics(
        manager: KalturaClientManager,
        report_type: str = "viewers",
        entry_id: Optional[str] = None,
    ) -> str:
        """
        Get real-time analytics data updated every ~30 seconds.
    
        This function provides live metrics for monitoring current activity,
        perfect for dashboards, live events, and immediate feedback.
    
        USE WHEN:
        - Monitoring live events or broadcasts
        - Creating real-time dashboards
        - Tracking immediate impact of campaigns
        - Monitoring current platform activity
        - Detecting issues as they happen
    
        Args:
            manager: Kaltura client manager
            report_type: Type of real-time data:
                - "viewers": Current viewer count and activity
                - "geographic": Live viewer distribution by location
                - "quality": Real-time streaming quality metrics
            entry_id: Optional entry ID for content-specific metrics
    
        Returns:
            JSON with current metrics and recent trends:
            {
                "timestamp": "2024-01-15T14:30:00Z",
                "current": {
                    "active_viewers": 1234,
                    "plays_per_minute": 45,
                    "bandwidth_mbps": 890
                },
                "trend": {
                    "viewers_change": "+12%",
                    "peak_viewers": 1456,
                    "trend_direction": "increasing"
                },
                "by_content": [...]  // If no entry_id specified
            }
    
        Examples:
            # Monitor platform-wide activity
            get_realtime_metrics(manager)
    
            # Track specific live event
            get_realtime_metrics(manager, entry_id="1_live123")
    
            # Check streaming quality
            get_realtime_metrics(manager, report_type="quality")
        """
        # Map friendly names to report types
        report_map = {
            "viewers": "realtime_users",
            "geographic": "realtime_country",
            "quality": "realtime_qos",
        }
    
        from .analytics_core import get_realtime_analytics
    
        result = await get_realtime_analytics(
            manager=manager,
            report_type=report_map.get(report_type, "realtime_users"),
            entry_id=entry_id,
        )
    
        # Add timestamp and formatting
        data = json.loads(result)
        data["timestamp"] = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
    
        return json.dumps(data, indent=2)
  • Defines the input schema, description, and parameters for the get_realtime_metrics tool in the MCP server's tool list.
    types.Tool(
        name="get_realtime_metrics",
        description="Get LIVE analytics updating every 30 seconds. USE WHEN: Monitoring live events/streams, building real-time dashboards, tracking immediate campaign impact, detecting issues as they happen. RETURNS: Current active viewers, plays per minute, bandwidth usage. EXAMPLES: 'How many people watching right now?', 'Monitor live event performance', 'Track viral video in real-time'. Different from historical analytics - this is NOW.",
        inputSchema={
            "type": "object",
            "properties": {
                "report_type": {
                    "type": "string",
                    "enum": ["viewers", "geographic", "quality"],
                    "description": "What to monitor (default: 'viewers'): 'viewers' = active viewer count, 'geographic' = viewer locations, 'quality' = streaming performance/buffering.",
                },
                "entry_id": {
                    "type": "string",
                    "description": "Optional entry ID for content-specific metrics",
                },
            },
        },
    ),
  • Registers and dispatches calls to the get_realtime_metrics handler in the MCP server's call_tool function.
    elif name == "get_realtime_metrics":
        result = await get_realtime_metrics(kaltura_manager, **arguments)
  • Imports the get_realtime_metrics handler from analytics.py for use in the tools module.
    from .analytics import (
        get_analytics,
        get_analytics_timeseries,
        get_geographic_breakdown,
        get_quality_metrics,
        get_realtime_metrics,
        get_video_retention,
        list_analytics_capabilities,
    )
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 traits: real-time nature ('updating every 30 seconds'), scope ('LIVE analytics'), and return values. However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions, which would be helpful for a real-time monitoring tool.

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 well-structured with clear sections (purpose, usage guidelines, returns, examples, differentiation) and every sentence adds value. It's appropriately sized for a tool with real-time complexity, front-loading key information without unnecessary elaboration.

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 real-time monitoring complexity and lack of output schema, the description does well by explaining return values and providing usage examples. However, without annotations and with behavioral aspects like rate limits or error handling unaddressed, there's room for improvement in fully preparing an agent for invocation.

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. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3. The 'RETURNS' section describes output values but doesn't clarify how they map to parameters.

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 LIVE analytics') and resources ('analytics updating every 30 seconds'), distinguishing it from siblings like 'get_analytics' or 'get_analytics_timeseries' by emphasizing real-time nature. The final sentence explicitly differentiates it from historical analytics.

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 guidelines with a dedicated 'USE WHEN:' section listing specific scenarios (monitoring live events, building real-time dashboards, tracking campaign impact, detecting issues). It also states when not to use it ('Different from historical analytics - this is NOW'), offering clear 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