Skip to main content
Glama

edit-draft

Update an existing message draft in Zulip by modifying recipients, topic, content, or timestamp before sending.

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
draft_idYesUnique draft ID to edit
typeYesDraft message type
toYesArray of user IDs or channel ID
topicYesTopic for the draft
contentYesDraft content
timestampNoUpdated timestamp

Implementation Reference

  • The primary handler function for the 'edit-draft' tool. It destructures input parameters, calls zulipClient.editDraft to perform the update, and returns success/error responses.
    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 schema that validates and describes the input parameters for the 'edit-draft' tool.
    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") });
  • src/server.ts:736-754 (registration)
    Registers the 'edit-draft' tool with the MCP server, including name, description, input schema, and handler function.
    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'}`); } } );
  • ZulipClient helper method that makes the actual PATCH request to Zulip's /drafts/{draftId} API endpoint to edit the 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