Skip to main content
Glama

edit-draft

Update an existing message draft by specifying its ID and providing new type, recipients, topic, and content.

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 async handler function for the 'edit-draft' tool. It accepts draft_id, type, to, topic, content, timestamp, calls zulipClient.editDraft, and returns a success/error response.
    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 (EditDraftSchema) defining the input shape for 'edit-draft': draft_id (number), type (enum 'stream'|'direct'), to (array of numbers), topic (string), content (string), timestamp (optional number).
    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)
    Server registration of the 'edit-draft' tool via server.tool() with name, description, schema, and handler.
    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.editDraft helper method that sends a PATCH request to /drafts/{draftId} with the draft parameters.
    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?

No annotations are provided, so the description must fully disclose behavior. It only states 'update' without detailing side effects, idempotency, prerequisites (e.g., draft existence), or return value. This is insufficient for a mutation tool.

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

Conciseness4/5

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

The description consists of two sentences that directly convey the purpose and a key usage hint. It is concise and front-loaded, though the hint could be more concisely integrated.

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

Completeness2/5

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

Given the tool has 6 parameters, no output schema, and no annotations, the description lacks information about expected output, error conditions, update semantics (partial vs. full), and constraints like the 'type' enum. It is incomplete for the complexity.

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 input schema has 100% description coverage, so the baseline is 3. The description adds value by explaining how to use the 'to' parameter (use users-directory tool), but provides no additional semantics for the other five parameters.

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 'Update an existing message draft,' specifying the verb and resource. It differentiates from siblings like create-draft and edit-message by focusing on drafts, but does not explicitly contrast with them.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives (e.g., create-draft, edit-message). The only guidance is for using a complementary tool to discover user IDs, not for choosing this tool.

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