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);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions that this updates an existing draft (implying mutation), it doesn't address critical behavioral aspects: what permissions are required, whether the update is reversible, what happens if required fields are omitted, or what the response looks like. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with just two sentences. The first sentence states the core purpose, and the second provides essential usage guidance for a key parameter. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is a mutation tool with no annotations and no output schema, the description should do more to compensate. While it provides good purpose clarity and parameter guidance, it lacks critical behavioral context about permissions, side effects, and response format. The description is adequate for basic understanding but incomplete for safe and effective tool invocation in a complex environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, meaning all parameters are documented in the schema itself. The description adds some value by explaining how to populate the 'to' field with user IDs, which provides practical guidance beyond the schema's technical description. However, it doesn't add significant semantic context for other parameters like 'type', 'topic', or 'content', so it meets the baseline for good schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing message draft'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'edit-message' or 'create-draft', which would require more specific context about what distinguishes editing drafts from editing sent messages or creating new drafts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use this tool by explaining how to populate the 'to' field ('use the users-directory resource or get-users tool to discover available users and their IDs'). This gives practical context for parameter usage. However, it doesn't explicitly state when NOT to use this tool versus alternatives like 'edit-message' or 'create-draft', which would be needed for a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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