Skip to main content
Glama

edit-message

Modify message content or topic in Zulip workspaces. Input the message ID and updated content or topic to edit existing messages directly through the MCP server API.

Instructions

Edit an existing message's content or topic.

Input Schema

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

Implementation Reference

  • MCP tool handler: destructures params, filters undefined fields, calls ZulipClient.updateMessage, handles errors and formats MCP response.
    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'}`); } }
  • src/server.ts:497-513 (registration)
    Tool registration with MCP server: registers 'edit-message' tool with description, input schema, and handler function.
    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 input schema for edit-message tool defining message_id (required), content and topic (optional).
    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: filters params and makes PATCH request to Zulip API /messages/{id} endpoint.
    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); }

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