get-stream-by-id
Retrieve detailed stream information, including settings, description, and subscriber count, by providing the unique stream ID in Zulip MCP Server.
Instructions
📊 STREAM DETAILS: Get comprehensive information about a stream (channel) when you have its numeric ID. Returns stream settings, description, subscriber count, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_subscribers | No | Include subscriber list | |
| stream_id | Yes | Unique stream ID to get details for |
Implementation Reference
- src/server.ts:797-820 (handler)Handler implementation for the 'get-stream-by-id' tool. Registers the tool with MCP server and provides the execution logic that fetches stream data via ZulipClient and formats the response.server.tool( "get-stream-by-id", "📊 STREAM DETAILS: Get comprehensive information about a stream (channel) when you have its numeric ID. Returns stream settings, description, subscriber count, etc.", GetStreamByIdSchema.shape, async ({ stream_id, include_subscribers }) => { try { const result = await zulipClient.getStream(stream_id, include_subscribers); return createSuccessResponse(JSON.stringify({ stream: { id: result.stream.stream_id, name: result.stream.name, description: result.stream.description, invite_only: result.stream.invite_only, is_web_public: result.stream.is_web_public, is_archived: result.stream.is_archived, is_announcement_only: result.stream.is_announcement_only, date_created: new Date(result.stream.date_created * 1000).toISOString() } }, null, 2)); } catch (error) { return createErrorResponse(`Error getting stream by ID: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/types.ts:246-249 (schema)Zod schema defining input parameters for the 'get-stream-by-id' tool: stream_id (required number) and include_subscribers (optional boolean).export const GetStreamByIdSchema = z.object({ stream_id: z.number().describe("Unique stream ID to get details for"), include_subscribers: z.boolean().optional().describe("Include subscriber list") });
- src/zulip/client.ts:362-366 (helper)ZulipClient method that performs the actual API call to retrieve stream details by ID from the Zulip server, used by the tool handler.async getStream(streamId: number, includeSubscribers?: boolean): Promise<{ stream: ZulipStream }> { const params = includeSubscribers ? { include_subscribers: true } : {}; const response = await this.client.get(`/streams/${streamId}`, { params }); return response.data; }