get-topics-in-stream
Retrieve recent conversation threads in a specific Zulip stream using the stream ID. Quickly browse active discussions to stay informed on relevant 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:585-600 (handler)MCP tool handler: extracts stream_id, calls ZulipClient.getStreamTopics, formats response with topic list including names and max_id.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:581-601 (registration)Tool registration with MCP server: defines name, description, input schema, and handler function.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/types.ts:212-214 (schema)Zod input schema validation: requires 'stream_id' as a number.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: performs the actual API request to retrieve topics for a stream.async getStreamTopics(streamId: number): Promise<{ topics: ZulipTopic[] }> { const response = await this.client.get(`/users/me/${streamId}/topics`); return response.data; }