zulip_subscribe_to_channel
Subscribe the bot to a Zulip channel (stream) to enable message posting and interaction within that specific conversation space.
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)The handler function within the CallToolRequest switch statement that executes the zulip_subscribe_to_channel tool. It validates the input arguments and calls the ZulipClient's subscribeToStream method to perform the subscription.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:203-212 (schema)JSON Schema defining the input parameters for the zulip_subscribe_to_channel tool, specifying channel_name as a required string.inputSchema: { type: "object", properties: { channel_name: { type: "string", description: "The name of the stream to subscribe to", }, }, required: ["channel_name"], },
- index.ts:200-213 (registration)The Tool object registration that defines the name, description, and input schema for zulip_subscribe_to_channel, used in ListToolsRequest response.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)Helper method in ZulipClient class that performs the actual Zulip API call to subscribe to the specified stream/channel.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:62-64 (schema)TypeScript interface used for type-checking the tool's input arguments in the handler.interface SubscribeToChannelArgs { channel_name: string; }