get-stream-id
Retrieve the numeric ID of a Zulip stream using its name to enable API operations requiring stream identification.
Instructions
š¢ STREAM ID LOOKUP: Get the numeric ID of a stream (channel) when you know its name. Use this to get the stream ID needed for other operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stream_name | Yes | Name of the stream to get ID for |
Implementation Reference
- src/server.ts:780-795 (handler)MCP tool registration and handler for 'get-stream-id'. Registers the tool with server.tool(), provides description and schema, and implements the handler logic that calls ZulipClient.getStreamId(stream_name) and formats the response.server.tool( "get-stream-id", "š¢ STREAM ID LOOKUP: Get the numeric ID of a stream (channel) when you know its name. Use this to get the stream ID needed for other operations.", GetStreamIdSchema.shape, async ({ stream_name }) => { try { const result = await zulipClient.getStreamId(stream_name); return createSuccessResponse(JSON.stringify({ stream_name, stream_id: result.stream_id }, null, 2)); } catch (error) { return createErrorResponse(`Error getting stream ID: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/types.ts:242-244 (schema)Zod schema defining the input parameters for the get-stream-id tool: requires 'stream_name' string.export const GetStreamIdSchema = z.object({ stream_name: z.string().describe("Name of the stream to get ID for") });
- src/zulip/client.ts:355-360 (helper)ZulipClient helper method that performs the actual Zulip API call to retrieve stream ID by name via GET /get_stream_id?stream={streamName}.async getStreamId(streamName: string): Promise<{ stream_id: number }> { const response = await this.client.get('/get_stream_id', { params: { stream: streamName } }); return response.data; }