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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "zulip_list_channels"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_private | No | Whether to include private streams | |
| include_web_public | No | Whether to include web-public streams | |
| include_subscribed | No | Whether to include streams the bot is subscribed to |
Implementation Reference
- index.ts:408-418 (handler)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) }], }; } - index.ts:67-90 (schema)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, }, }, }, }; - index.ts:240-261 (helper)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, ], }; }); - index.ts:29-33 (schema)TypeScript interface defining the expected input arguments for the tool.
interface ListChannelsArgs { include_private?: boolean; include_web_public?: boolean; include_subscribed?: boolean; }