Skip to main content
Glama

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
NameRequiredDescriptionDefault
channel_nameYesThe name of the stream to subscribe to

Implementation Reference

  • 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) }],
      };
    }
  • 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"],
      },
    };
  • 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;
      }
    }
  • TypeScript interface used for type-checking the tool's input arguments in the handler.
    interface SubscribeToChannelArgs {
      channel_name: string;
    }

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/Monadical-SAS/zulip-mcp'

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