Skip to main content
Glama

zulip_list_channels

Retrieve available channels (streams) from a Zulip organization, with options to filter by privacy settings and subscription status.

Instructions

List available channels (streams) in the Zulip organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_privateNoWhether to include private streams
include_web_publicNoWhether to include web-public streams
include_subscribedNoWhether to include streams the bot is subscribed to

Implementation Reference

  • Dispatches the tool call by parsing arguments and invoking the ZulipClient.getStreams method to list channels.
    case "zulip_list_channels": {
      const args = request.params.arguments as unknown as ListChannelsArgs;
      const response = await zulipClient.getStreams(
        args.include_private,
        args.include_web_public,
        args.include_subscribed
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the tool schema including input validation for parameters like include_private, include_web_public, and include_subscribed.
    const listChannelsTool: Tool = {
      name: "zulip_list_channels",
      description: "List available channels (streams) in the Zulip organization",
      inputSchema: {
        type: "object",
        properties: {
          include_private: {
            type: "boolean",
            description: "Whether to include private streams",
            default: false,
          },
          include_web_public: {
            type: "boolean",
            description: "Whether to include web-public streams",
            default: true,
          },
          include_subscribed: {
            type: "boolean",
            description: "Whether to include streams the bot is subscribed to",
            default: true,
          },
        },
      },
    };
  • ZulipClient method that constructs parameters based on filters and retrieves the list of streams (channels) from the Zulip API.
    async getStreams(includePrivate = false, includeWebPublic = true, includeSubscribed = true) {
      try {
        const params: any = {};
        
        if (includePrivate) {
          params.include_private = true;
        }
        
        if (!includeWebPublic) {
          params.include_web_public = false;
        }
        
        if (!includeSubscribed) {
          params.include_subscribed = false;
        }
        
        return await this.client.streams.retrieve(params);
      } catch (error) {
        console.error("Error getting streams:", error);
        throw error;
      }
    }
  • index.ts:535-549 (registration)
    Registers the zulip_list_channels tool (as listChannelsTool) in the ListTools response for tool discovery.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          sendDirectMessageTool,
          addReactionTool,
          getChannelHistoryTool,
          getTopicsTool,
          subscribeToChannelTool,
          getUsersTool,
        ],
      };
    });
  • TypeScript interface defining the expected input arguments for the tool.
    interface ListChannelsArgs {
      include_private?: boolean;
      include_web_public?: boolean;
      include_subscribed?: boolean;
    }

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