Skip to main content
Glama

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
NameRequiredDescriptionDefault
stream_idYesUnique 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'}`);
        }
      }
    );
  • 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'}`);
        }
      }
    );
  • 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")
    });
  • 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;
    }

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/avisekrath/zulip-mcp-server'

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