get-topics-in-stream
Retrieve recent conversation threads from a specific Zulip stream to browse active discussions and monitor ongoing topics.
Instructions
š¬ STREAM TOPICS: Get all recent topics (conversation threads) in a specific stream (channel). Use this to browse what's being discussed in a stream.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stream_id | Yes | Unique stream ID to get topics for |
Implementation Reference
- src/server.ts:581-601 (registration)Registration of the 'get-topics-in-stream' MCP tool, including description, input schema reference, and inline handler function that delegates to ZulipClient and formats the response.server.tool( "get-topics-in-stream", "š¬ STREAM TOPICS: Get all recent topics (conversation threads) in a specific stream (channel). Use this to browse what's being discussed in a stream.", GetStreamTopicsSchema.shape, async ({ stream_id }) => { try { const result = await zulipClient.getStreamTopics(stream_id); return createSuccessResponse(JSON.stringify({ stream_id, topic_count: result.topics.length, topics: result.topics.map(topic => ({ name: topic.name, max_id: topic.max_id })) }, null, 2)); } catch (error) { return createErrorResponse(`Error getting stream topics: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/server.ts:585-601 (handler)Inline handler function for the tool: takes stream_id, fetches topics via ZulipClient, maps to summary format, and returns JSON response or error.async ({ stream_id }) => { try { const result = await zulipClient.getStreamTopics(stream_id); return createSuccessResponse(JSON.stringify({ stream_id, topic_count: result.topics.length, topics: result.topics.map(topic => ({ name: topic.name, max_id: topic.max_id })) }, null, 2)); } catch (error) { return createErrorResponse(`Error getting stream topics: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/types.ts:212-214 (schema)Zod schema defining the input parameter 'stream_id' (number) for the tool.export const GetStreamTopicsSchema = z.object({ stream_id: z.number().describe("Unique stream ID to get topics for") });
- src/zulip/client.ts:368-371 (helper)ZulipClient helper method that performs the actual Zulip API call to retrieve topics for a given stream ID and returns raw API response.async getStreamTopics(streamId: number): Promise<{ topics: ZulipTopic[] }> { const response = await this.client.get(`/users/me/${streamId}/topics`); return response.data; }