Skip to main content
Glama

edit-draft

Edit an existing message draft on the Zulip MCP Server by updating its type, recipients, topic, content, and timestamp using the draft ID.

Instructions

Update an existing message draft. For user IDs in the 'to' field, use the users-directory resource (zulip://users) or get-users tool to discover available users and their IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesDraft content
draft_idYesUnique draft ID to edit
timestampNoUpdated timestamp
toYesArray of user IDs or channel ID
topicYesTopic for the draft
typeYesDraft message type

Implementation Reference

  • MCP tool registration and handler implementation for the 'edit-draft' tool. This function processes tool calls, invokes the ZulipClient.editDraft method, and formats MCP-compliant responses.
    server.tool( "edit-draft", "Update an existing message draft. For user IDs in the 'to' field, use the users-directory resource (zulip://users) or get-users tool to discover available users and their IDs.", EditDraftSchema.shape, async ({ draft_id, type, to, topic, content, timestamp }) => { try { await zulipClient.editDraft(draft_id, { type, to, topic, content, timestamp }); return createSuccessResponse(`Draft ${draft_id} updated successfully!`); } catch (error) { return createErrorResponse(`Error editing draft: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
  • Zod input schema definition for the 'edit-draft' tool, used for validation in the MCP server.tool registration.
    export const EditDraftSchema = z.object({ draft_id: z.number().describe("Unique draft ID to edit"), type: z.enum(["stream", "direct"]).describe("Draft message type"), to: z.array(z.number()).describe("Array of user IDs or channel ID"), topic: z.string().describe("Topic for the draft"), content: z.string().describe("Draft content"), timestamp: z.number().optional().describe("Updated timestamp") });
  • ZulipClient helper method that executes the actual HTTP PATCH request to the Zulip API endpoint `/drafts/{draftId}` to update a draft.
    async editDraft(draftId: number, params: { type: 'stream' | 'direct'; to: number[]; topic: string; content: string; timestamp?: number; }): Promise<void> { await this.client.patch(`/drafts/${draftId}`, params); }

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