zulip_get_topics
Retrieve topics from a Zulip channel to organize and access conversation threads efficiently.
Instructions
Get topics in a channel (stream)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | The ID of the stream |
Implementation Reference
- index.ts:487-496 (handler)The main handler for the 'zulip_get_topics' tool within the CallToolRequest handler switch statement. It validates the channel_id argument and calls ZulipClient.getTopics.case "zulip_get_topics": { const args = request.params.arguments as unknown as GetTopicsArgs; if (args.channel_id === undefined) { throw new Error("Missing required argument: channel_id"); } const response = await zulipClient.getTopics(args.channel_id); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- index.ts:58-60 (schema)TypeScript interface defining the input arguments for the zulip_get_topics tool.interface GetTopicsArgs { channel_id: number; }
- index.ts:185-198 (registration)Tool object definition including name, description, and input schema, used for registration.const getTopicsTool: Tool = { name: "zulip_get_topics", description: "Get topics in a channel (stream)", inputSchema: { type: "object", properties: { channel_id: { type: "number", description: "The ID of the stream", }, }, required: ["channel_id"], }, };
- index.ts:336-343 (helper)Core helper method in ZulipClient that retrieves topics for a given stream_id using the Zulip client API.async getTopics(streamId: number) { try { return await this.client.streams.topics.retrieve({ stream_id: streamId }); } catch (error) { console.error("Error getting topics:", error); throw error; } }
- index.ts:538-548 (registration)Registration of the tool in the ListToolsRequest handler by including getTopicsTool in the returned tools array.tools: [ listChannelsTool, postMessageTool, sendDirectMessageTool, addReactionTool, getChannelHistoryTool, getTopicsTool, subscribeToChannelTool, getUsersTool, ], };