Skip to main content
Glama

zulip_get_channel_history

Retrieve recent messages from a Zulip channel and topic to access conversation history for review or analysis.

Instructions

Get recent messages from a channel (stream) and topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_nameYesThe name of the stream
topicYesThe topic name
limitNoNumber of messages to retrieve (default 20)
anchorNoMessage ID to start from (default 'newest')newest

Implementation Reference

  • Handles the 'zulip_get_channel_history' tool call by validating arguments and delegating to ZulipClient.getMessages method.
    case "zulip_get_channel_history": {
      const args = request.params.arguments as unknown as GetChannelHistoryArgs;
      if (!args.channel_name || !args.topic) {
        throw new Error(
          "Missing required arguments: channel_name and topic"
        );
      }
      const response = await zulipClient.getMessages(
        args.channel_name,
        args.topic,
        args.limit,
        args.anchor
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the tool's name, description, and input schema for validation.
    const getChannelHistoryTool: Tool = {
      name: "zulip_get_channel_history",
      description: "Get recent messages from a channel (stream) and topic",
      inputSchema: {
        type: "object",
        properties: {
          channel_name: {
            type: "string",
            description: "The name of the stream",
          },
          topic: {
            type: "string",
            description: "The topic name",
          },
          limit: {
            type: "number",
            description: "Number of messages to retrieve (default 20)",
            default: 20,
          },
          anchor: {
            type: "string",
            description: "Message ID to start from (default 'newest')",
            default: "newest",
          },
        },
        required: ["channel_name", "topic"],
      },
    };
  • index.ts:538-548 (registration)
    Registers the tool by including it in the list returned by ListToolsRequest handler.
      tools: [
        listChannelsTool,
        postMessageTool,
        sendDirectMessageTool,
        addReactionTool,
        getChannelHistoryTool,
        getTopicsTool,
        subscribeToChannelTool,
        getUsersTool,
      ],
    };
  • Core implementation that retrieves messages from Zulip using the client, finding stream ID and constructing narrow parameters.
    async getMessages(streamName: string, topic: string, limit = 20, anchor = "newest") {
      try {
        // First, need to find the stream ID
        const streamsResponse = await this.getStreams(true, true, true);
        const stream = streamsResponse.streams.find((s: any) => s.name === streamName);
        
        if (!stream) {
          throw new Error(`Stream "${streamName}" not found`);
        }
        
        // Construct narrow to filter by stream and topic
        const narrow = [
          { operator: "stream", operand: streamName },
          { operator: "topic", operand: topic },
        ];
        
        const params = {
          narrow: JSON.stringify(narrow),
          num_before: Math.floor(limit / 2),
          num_after: Math.floor(limit / 2),
          anchor: anchor,
        };
        
        return await this.client.messages.retrieve(params);
      } catch (error) {
        console.error("Error getting messages:", error);
        throw error;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves messages but doesn't cover critical aspects like whether it's read-only (implied but not explicit), pagination behavior, rate limits, authentication needs, or error handling. For a tool with no annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and appropriately sized, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a tool with 4 parameters and behavioral complexity. It lacks details on return values, error conditions, or operational constraints, which are crucial for an agent to use the tool effectively in context with sibling tools.

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?

Schema description coverage is 100%, so the schema already documents all parameters with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as explaining relationships between parameters or usage nuances. Baseline 3 is appropriate when the schema handles parameter documentation effectively.

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

Purpose4/5

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

The description clearly states the action ('Get recent messages') and resource ('from a channel (stream) and topic'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'zulip_get_topics' or 'zulip_list_channels', which also retrieve information but about different resources.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare it to sibling tools like 'zulip_get_topics' for topic lists or 'zulip_post_message' for sending messages, leaving the agent without contextual usage cues.

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

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