get_current_stream
Retrieve current stream details including title, status, RTMP URL, and viewer count to monitor active broadcasts across multiple platforms.
Instructions
Get information about the current/active stream including title, status, RTMP URL, and viewer count
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:247-257 (handler)MCP tool handler for 'get_current_stream' that delegates to RestreamClient.getCurrentStream() and returns formatted JSON response or 'No active stream' message.case 'get_current_stream': { const stream = await restreamClient.getCurrentStream(); return { content: [ { type: 'text', text: stream ? JSON.stringify(stream, null, 2) : 'No active stream', }, ], }; }
- src/index.ts:92-100 (registration)Registration of the 'get_current_stream' tool in the tools array, including 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: [], }, },
- src/restream-client.ts:129-139 (helper)Core implementation of getCurrentStream method in RestreamClient that makes API call to '/user/stream' and handles 404 as null (no active stream).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/types.ts:35-43 (schema)TypeScript interface defining the Stream type used as input/output schema for get_current_stream tool.export interface Stream { id: string; title: string; isLive: boolean; streamKey?: string; rtmpUrl?: string; viewers?: number; startedAt?: string; }