Skip to main content
Glama

get-topics-in-stream

Retrieve all recent topics (conversation threads) in a specific stream to browse what's being discussed.

Instructions

💬 STREAM TOPICS: Get all recent topics (conversation threads) in a specific stream (channel). Use this to browse what's being discussed in a stream.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stream_idYesUnique stream ID to get topics for

Implementation Reference

  • Handler function for 'get-topics-in-stream'. Calls zulipClient.getStreamTopics(stream_id) and returns a formatted JSON response with stream_id, topic_count, and topics array (each with name and max_id).
      async ({ stream_id }) => {
        try {
          const result = await zulipClient.getStreamTopics(stream_id);
          
          return createSuccessResponse(JSON.stringify({
            stream_id,
            topic_count: result.topics.length,
            topics: result.topics.map(topic => ({
              name: topic.name,
              max_id: topic.max_id
            }))
          }, null, 2));
        } catch (error) {
          return createErrorResponse(`Error getting stream topics: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • src/server.ts:581-601 (registration)
    Registration of the 'get-topics-in-stream' tool via server.tool() with description and schema.
    server.tool(
      "get-topics-in-stream",
      "💬 STREAM TOPICS: Get all recent topics (conversation threads) in a specific stream (channel). Use this to browse what's being discussed in a stream.",
      GetStreamTopicsSchema.shape,
      async ({ stream_id }) => {
        try {
          const result = await zulipClient.getStreamTopics(stream_id);
          
          return createSuccessResponse(JSON.stringify({
            stream_id,
            topic_count: result.topics.length,
            topics: result.topics.map(topic => ({
              name: topic.name,
              max_id: topic.max_id
            }))
          }, null, 2));
        } catch (error) {
          return createErrorResponse(`Error getting stream topics: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • Zod schema GetStreamTopicsSchema defining the input: stream_id (number).
    export const GetStreamTopicsSchema = z.object({
      stream_id: z.number().describe("Unique stream ID to get topics for")
    });
  • Type alias GetStreamTopicsParams inferred from the schema.
    export type GetStreamTopicsParams = z.infer<typeof GetStreamTopicsSchema>;
  • Helper method getStreamTopics in the ZulipClient class. Calls GET /users/me/{streamId}/topics API endpoint and returns topics.
    async getStreamTopics(streamId: number): Promise<{ topics: ZulipTopic[] }> {
      const response = await this.client.get(`/users/me/${streamId}/topics`);
      return response.data;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It describes the tool as retrieving 'recent topics', implying a read-only operation, but does not specify ordering, pagination, or permission requirements. This is adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, each serving a distinct purpose: first explains the tool's function, second gives usage guidance. No redundant information, and the key info is front-loaded. The emoji adds visual clarity without detracting.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool, the description covers the main action and use case. However, since there is no output schema, the return format (e.g., what fields are included, whether paginated) is omitted, leaving the agent without complete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides a clear description for the sole parameter (stream_id). The tool description does not add extra semantic meaning beyond reiterating that it's for topics in a stream. Baseline score of 3 is appropriate given 100% schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('all recent topics in a specific stream'), and differentiates from sibling tools like get-messages by focusing on conversation threads (topics). The emoji and bolded 'STREAM TOPICS' reinforce the tool's purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'Use this to browse what's being discussed in a stream' provides a clear usage context. However, it lacks explicit contrasts with alternatives (e.g., when to use get-messages instead) or exclusions, leaving some ambiguity for complex queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/avisekrath/zulip-mcp-server'

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