Skip to main content
Glama

edit-message

Modify existing message content or topic in Zulip workspaces by providing the message ID and updated text or subject.

Instructions

Edit an existing message's content or topic.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesUnique ID of the message to edit
contentNoNew message content with Markdown formatting
topicNoNew topic name (for stream messages only)

Implementation Reference

  • src/server.ts:497-513 (registration)
    MCP server.tool registration for 'edit-message' tool, including inline handler function that validates parameters and delegates to ZulipClient
    server.tool( "edit-message", "Edit an existing message's content or topic.", EditMessageSchema.shape, async ({ message_id, content, topic }) => { try { const updateParams = filterUndefined({ content, topic }); if (Object.keys(updateParams).length === 0) { return createErrorResponse('At least one of content or topic must be provided for message update'); } await zulipClient.updateMessage(message_id, updateParams); return createSuccessResponse(`Message ${message_id} updated successfully!`); } catch (error) { return createErrorResponse(`Error updating message: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
  • Zod schema defining the input parameters (message_id, optional content, optional topic) for the edit-message tool
    export const EditMessageSchema = z.object({ message_id: z.number().describe("Unique ID of the message to edit"), content: z.string().optional().describe("New message content with Markdown formatting"), topic: z.string().optional().describe("New topic name (for stream messages only)") });
  • ZulipClient helper method that performs the actual HTTP PATCH request to Zulip's /messages/{id} endpoint to update message content or topic
    async updateMessage(messageId: number, params: { content?: string; topic?: string; }): Promise<void> { // Filter out undefined values const filteredParams = Object.fromEntries( Object.entries(params).filter(([, value]) => value !== undefined) ); await this.client.patch(`/messages/${messageId}`, filteredParams); }
  • Utility helper function to remove undefined properties from parameter objects before API calls, used in edit-message handler
    function filterUndefined<T extends Record<string, any>>(obj: T): Partial<T> { return Object.fromEntries( Object.entries(obj).filter(([_, value]) => value !== undefined) ) as Partial<T>; }

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