Skip to main content
Glama

get-message

Retrieve complete details for a specific Zulip message using its ID to analyze content, edit history, reactions, and metadata.

Instructions

πŸ” SINGLE MESSAGE: Get complete details about one specific message when you have its ID. Use this for in-depth analysis, checking edit history, reactions, or metadata. Returns single message with full details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesUnique message ID to retrieve
apply_markdownNoReturn HTML content (true) or raw Markdown (false). Default: true
allow_empty_topic_nameNoAllow empty topic names in response (default: false)

Implementation Reference

  • Handler function for the 'get-message' tool. Fetches a single message by ID using the ZulipClient, formats the response, and handles errors.
    async ({ message_id, apply_markdown, allow_empty_topic_name }) => {
      try {
        const result = await zulipClient.getMessage(message_id, {
          apply_markdown,
          allow_empty_topic_name
        });
        
        return createSuccessResponse(JSON.stringify({
          message: {
            id: result.message.id,
            sender: result.message.sender_full_name,
            timestamp: new Date(result.message.timestamp * 1000).toISOString(),
            content: result.message.content,
            type: result.message.type,
            topic: result.message.topic || result.message.subject,
            stream_id: result.message.stream_id,
            reactions: result.message.reactions,
            edit_history: result.message.edit_history
          }
        }, null, 2));
      } catch (error) {
        return createErrorResponse(`Error getting message: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • src/server.ts:887-914 (registration)
    Registration of the 'get-message' tool using McpServer.tool(), including name, description, input schema, and handler.
      "get-message",
      "πŸ” SINGLE MESSAGE: Get complete details about one specific message when you have its ID. Use this for in-depth analysis, checking edit history, reactions, or metadata. Returns single message with full details.",
      GetMessageSchema.shape,
      async ({ message_id, apply_markdown, allow_empty_topic_name }) => {
        try {
          const result = await zulipClient.getMessage(message_id, {
            apply_markdown,
            allow_empty_topic_name
          });
          
          return createSuccessResponse(JSON.stringify({
            message: {
              id: result.message.id,
              sender: result.message.sender_full_name,
              timestamp: new Date(result.message.timestamp * 1000).toISOString(),
              content: result.message.content,
              type: result.message.type,
              topic: result.message.topic || result.message.subject,
              stream_id: result.message.stream_id,
              reactions: result.message.reactions,
              edit_history: result.message.edit_history
            }
          }, null, 2));
        } catch (error) {
          return createErrorResponse(`Error getting message: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • Zod schema defining input parameters for the 'get-message' tool: message_id (required), apply_markdown and allow_empty_topic_name (optional).
    export const GetMessageSchema = z.object({
      message_id: z.number().describe("Unique message ID to retrieve"),
      apply_markdown: z.boolean().optional().describe("Return HTML content (true) or raw Markdown (false). Default: true"),
      allow_empty_topic_name: z.boolean().optional().describe("Allow empty topic names in response (default: false)")
    });
  • ZulipClient.getMessage method that makes the actual API call to retrieve the message details from the Zulip server.
    async getMessage(messageId: number, params: {
      apply_markdown?: boolean;
      allow_empty_topic_name?: boolean;
    } = {}): Promise<{ message: ZulipMessage }> {
      debugLog('πŸ” Debug - getMessage called with:', { messageId, ...params });
      
      const response = await this.client.get(`/messages/${messageId}`, { params });
      debugLog('βœ… Debug - Message retrieved successfully:', response.data);
      return response.data;
    }

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