get-message
Retrieve complete details of a Zulip message using its ID. Access edit history, reactions, and metadata for in-depth analysis.
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
| 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/zulip/client.ts:510-519 (handler)The getMessage method on ZulipClient that makes the actual HTTP GET request to /messages/{messageId} to retrieve a single message by its ID.
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; } - src/server.ts:886-914 (handler)The MCP tool handler function for 'get-message'. It validates input via GetMessageSchema, calls zulipClient.getMessage(), and formats the response with message details like sender, timestamp, content, type, topic, stream_id, reactions, and edit_history.
server.tool( "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)The GetMessageSchema Zod schema defining input validation for the get-message tool: message_id (required number), apply_markdown (optional boolean), and allow_empty_topic_name (optional boolean).
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/server.ts:886-914 (registration)Registration of the 'get-message' tool with the MCP server via server.tool(). The tool name 'get-message' is registered with schema from GetMessageSchema.shape and the handler function.
server.tool( "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:10-25 (helper)The ZulipMessage interface which defines the shape of a message object returned from the Zulip API, including fields like id, content, reactions, edit_history etc.
export interface ZulipMessage { id: number; sender_id: number; sender_full_name: string; sender_email: string; timestamp: number; content: string; content_type: string; stream_id?: number; subject?: string; topic?: string; type: "stream" | "private"; recipient_id: number; reactions: ZulipReaction[]; edit_history?: ZulipEditHistory[]; }