Skip to main content
Glama

get_current_stream

Retrieve details of the active live stream, including title, status, RTMP URL, and viewer count, for monitoring and management.

Instructions

Get information about the current/active stream including title, status, RTMP URL, and viewer count

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool execution handler for 'get_current_stream' that delegates to RestreamClient.getCurrentStream() and formats the response as MCP content.
    case 'get_current_stream': {
      const stream = await restreamClient.getCurrentStream();
      return {
        content: [
          {
            type: 'text',
            text: stream ? JSON.stringify(stream, null, 2) : 'No active stream',
          },
        ],
      };
    }
  • Core implementation of getCurrentStream() method in RestreamClient that fetches the current stream from the Restream API endpoint '/user/stream', handling 404 as null.
    async getCurrentStream(): Promise<Stream | null> {
      try {
        const response = await this.axiosInstance.get<Stream>('/user/stream');
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error) && error.response?.status === 404) {
          return null; // No active stream
        }
        throw this.handleError(error, 'Failed to fetch current stream');
      }
    }
  • src/index.ts:92-100 (registration)
    Registration of the 'get_current_stream' tool in the MCP tools list, including name, description, and empty input schema.
    {
      name: 'get_current_stream',
      description: 'Get information about the current/active stream including title, status, RTMP URL, and viewer count',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Type definition for Stream, used as the return type for getCurrentStream, defining the structure of stream information.
    export interface Stream {
      id: string;
      title: string;
      isLive: boolean;
      streamKey?: string;
      rtmpUrl?: string;
      viewers?: number;
      startedAt?: string;
    }

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/shaktech786/restream-mcp-server'

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