Skip to main content
Glama
wave-av

WAVE MCP Server

Official
by wave-av

wave_get_viewers

Retrieve current viewer count and optional demographics for a specific stream or account-wide totals.

Instructions

Get current viewer count and viewer demographics for a stream or across all streams

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stream_idNoStream ID to get viewers for. Omit for account-wide totals.
include_demographicsNoInclude geographic and device breakdown (default: false)

Implementation Reference

  • The 'registerAnalyticsTools' function registers 'wave_get_viewers' and other analytics tools on the MCP server via server.tool().
    export function registerAnalyticsTools(server: McpServer): void {
      server.tool(
        "wave_get_viewers",
        "Get current viewer count and viewer demographics for a stream or across all streams",
        {
          stream_id: z
            .string()
            .uuid()
            .optional()
            .describe("Stream ID to get viewers for. Omit for account-wide totals."),
          include_demographics: z
            .boolean()
            .optional()
            .describe("Include geographic and device breakdown (default: false)"),
        },
        async ({ stream_id, include_demographics }) => {
          const params = new URLSearchParams();
          if (stream_id) params.set("stream_id", stream_id);
          if (include_demographics) params.set("include_demographics", "true");
    
          const query = params.toString();
          const path = `/api/v1/analytics/viewers${query ? `?${query}` : ""}`;
          const res = await waveFetch(path);
          if (!res.ok) return errorContent(res.status, res.body);
    
          return textContent(res.body);
        },
      );
    
      server.tool(
        "wave_get_stream_metrics",
        "Get detailed performance metrics for a stream including bitrate, latency, quality scores, and error rates",
        {
          stream_id: z.string().uuid().describe("The UUID of the stream"),
          period: z
            .enum(["1h", "6h", "24h", "7d", "30d"])
            .optional()
            .describe("Time period for metrics aggregation (default: 24h)"),
          granularity: z
            .enum(["1m", "5m", "1h", "1d"])
            .optional()
            .describe("Data point granularity (default: 5m)"),
        },
        async ({ stream_id, period, granularity }) => {
          const params = new URLSearchParams();
          if (period) params.set("period", period);
          if (granularity) params.set("granularity", granularity);
    
          const query = params.toString();
          const path = `/api/v1/analytics/streams/${stream_id}/metrics${query ? `?${query}` : ""}`;
          const res = await waveFetch(path);
          if (!res.ok) return errorContent(res.status, res.body);
    
          return textContent(res.body);
        },
      );
    }
  • The 'wave_get_viewers' handler: accepts optional stream_id (UUID) and include_demographics (boolean), builds query params, calls GET /api/v1/analytics/viewers, and returns the raw JSON body or an error.
    server.tool(
      "wave_get_viewers",
      "Get current viewer count and viewer demographics for a stream or across all streams",
      {
        stream_id: z
          .string()
          .uuid()
          .optional()
          .describe("Stream ID to get viewers for. Omit for account-wide totals."),
        include_demographics: z
          .boolean()
          .optional()
          .describe("Include geographic and device breakdown (default: false)"),
      },
      async ({ stream_id, include_demographics }) => {
        const params = new URLSearchParams();
        if (stream_id) params.set("stream_id", stream_id);
        if (include_demographics) params.set("include_demographics", "true");
    
        const query = params.toString();
        const path = `/api/v1/analytics/viewers${query ? `?${query}` : ""}`;
        const res = await waveFetch(path);
        if (!res.ok) return errorContent(res.status, res.body);
    
        return textContent(res.body);
      },
    );
  • Input schema for 'wave_get_viewers' using Zod: stream_id (optional UUID string) and include_demographics (optional boolean).
    {
      stream_id: z
        .string()
        .uuid()
        .optional()
        .describe("Stream ID to get viewers for. Omit for account-wide totals."),
      include_demographics: z
        .boolean()
        .optional()
        .describe("Include geographic and device breakdown (default: false)"),
    },
  • 'waveFetch' helper used by the handler to make authenticated HTTP requests to the WAVE API.
    async function waveFetch(
      path: string,
      init?: RequestInit,
    ): Promise<{ ok: boolean; status: number; body: string }> {
      const url = `${getBaseUrl()}${path}`;
      const res = await fetch(url, {
        ...init,
        headers: {
          ...getAuthHeaders(),
          ...init?.headers,
        },
      });
      const body = await res.text();
      return { ok: res.ok, status: res.status, body };
    }
  • src/server.ts:22-22 (registration)
    Server entry point calls registerAnalyticsTools(server) to register the tool.
    registerAnalyticsTools(server);
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits beyond the operation itself. It does not state whether the tool is read-only, requires authentication, or has rate limits. For a simple read operation, some transparency is still expected.

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 a single, efficient sentence with no wasted words. It front-loads the core action ('Get current viewer count and viewer demographics') and immediately specifies scope.

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 simple schema and no output schema, the description covers the main functionality but lacks details on return format or behavior for invalid inputs. It is adequate but could be more complete.

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?

Schema coverage is 100% with good descriptions for both parameters. The description adds value by clarifying the effect of omitting stream_id (account-wide totals) and the meaning of the include_demographics parameter, exceeding the baseline of 3.

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 uses a specific verb ('Get') and resource ('viewer count and viewer demographics'), and explicitly states the scope ('for a stream or across all streams'). This clearly differentiates from sibling tools like wave_get_stream_metrics.

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 contexts (single stream vs. all streams) but does not provide explicit guidance on when not to use this tool or mention alternatives. Sibling tools like wave_get_stream_metrics exist but are not referenced.

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/wave-av/mcp-server'

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