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
| Name | Required | Description | Default |
|---|---|---|---|
| message_id | Yes | Unique message ID to retrieve | |
| apply_markdown | No | Return HTML content (true) or raw Markdown (false). Default: true | |
| allow_empty_topic_name | No | Allow empty topic names in response (default: false) |
Implementation Reference
- src/server.ts:890-913 (handler)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'}`); } } );
- src/types.ts:183-187 (schema)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)") });
- src/zulip/client.ts:510-519 (helper)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; }