zulip_subscribe_to_channel
Subscribe a bot to a Zulip channel (stream) to enable message posting and interaction within that specific workspace communication channel.
Instructions
Subscribe the bot to a channel (stream)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_name | Yes | The name of the stream to subscribe to |
Implementation Reference
- index.ts:498-507 (handler)Executes the zulip_subscribe_to_channel tool by parsing arguments, validating channel_name, and delegating to the ZulipClient's subscribeToStream method.case "zulip_subscribe_to_channel": { const args = request.params.arguments as unknown as SubscribeToChannelArgs; if (!args.channel_name) { throw new Error("Missing required argument: channel_name"); } const response = await zulipClient.subscribeToStream(args.channel_name); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- index.ts:200-213 (schema)Defines the Tool metadata, description, and input schema requiring 'channel_name' for the zulip_subscribe_to_channel tool.const subscribeToChannelTool: Tool = { name: "zulip_subscribe_to_channel", description: "Subscribe the bot to a channel (stream)", inputSchema: { type: "object", properties: { channel_name: { type: "string", description: "The name of the stream to subscribe to", }, }, required: ["channel_name"], }, };
- index.ts:345-353 (helper)Core helper method in ZulipClient that performs the actual subscription to the specified stream using the Zulip JS SDK.async subscribeToStream(streamName: string) { try { const subscriptions = [{ name: streamName }]; return await this.client.streams.subscribe({ subscriptions: JSON.stringify(subscriptions) }); } catch (error) { console.error("Error subscribing to stream:", error); throw error; } }
- index.ts:535-549 (registration)Registers the zulip_subscribe_to_channel tool (as subscribeToChannelTool) in the ListTools response.server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("Received ListToolsRequest"); return { tools: [ listChannelsTool, postMessageTool, sendDirectMessageTool, addReactionTool, getChannelHistoryTool, getTopicsTool, subscribeToChannelTool, getUsersTool, ], }; });