Skip to main content
Glama

create-draft

Compose and save a draft message for a stream or direct message in Zulip, ready for later editing or sending.

Instructions

📝 CREATE DRAFT: Save a message as draft for later editing or sending. For user IDs in the 'to' field, use search-users or get-users tool to discover available users and their IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesDraft message type: 'stream' for channels, 'private' for direct messages
toYesArray of user IDs for private messages, or single channel ID for stream messages
topicYesTopic for stream messages (required even for private messages in API)
contentYesDraft message content with Markdown formatting
timestampNoUnix timestamp for draft creation (optional, defaults to current time)

Implementation Reference

  • MCP tool handler for 'create-draft'. Calls zulipClient.createDraft() with validated params and returns success/error response.
    server.tool(
      "create-draft",
      "📝 CREATE DRAFT: Save a message as draft for later editing or sending. For user IDs in the 'to' field, use search-users or get-users tool to discover available users and their IDs.",
      CreateDraftSchema.shape,
      async ({ type, to, topic, content, timestamp }) => {
        try {
          const result = await zulipClient.createDraft({
            type,
            to,
            topic,
            content,
            timestamp
          });
          return createSuccessResponse(JSON.stringify({
            success: true,
            draft_ids: result.ids,
            message: `Draft created successfully! IDs: ${result.ids.join(', ')}`
          }, null, 2));
        } catch (error) {
          return createErrorResponse(`Error creating draft: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • Zod schema for create-draft input validation: type (stream/private), to (array of numbers), topic (string), content (string), timestamp (optional number).
    export const CreateDraftSchema = z.object({
      type: z.enum(["stream", "private"]).describe("Draft message type: 'stream' for channels, 'private' for direct messages"),
      to: z.array(z.number()).describe("Array of user IDs for private messages, or single channel ID for stream messages"),
      topic: z.string().describe("Topic for stream messages (required even for private messages in API)"),
      content: z.string().describe("Draft message content with Markdown formatting"),
      timestamp: z.number().optional().describe("Unix timestamp for draft creation (optional, defaults to current time)")
    });
  • ZulipClient.createDraft() method that POSTs draft data to the Zulip API /drafts endpoint. Constructs a draft object array and sends it URL-encoded.
    async createDraft(params: {
      type: 'stream' | 'private';
      to: number[];
      topic: string;
      content: string;
      timestamp?: number;
    }): Promise<{ ids: number[] }> {
      const draftObject: any = {
        type: params.type,
        to: params.to,
        topic: params.topic,
        content: params.content
      };
      
      // Only include timestamp if provided, otherwise let server set it
      if (params.timestamp !== undefined) {
        draftObject.timestamp = params.timestamp;
      }
      
      const payload = [draftObject];
      
      const response = await this.client.post('/drafts', {}, {
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        transformRequest: [() => {
          const params = new URLSearchParams();
          params.append('drafts', JSON.stringify(payload));
          return params.toString();
        }]
      });
      
      return response.data;
    }
  • src/server.ts:688-710 (registration)
    Tool registered via server.tool() call on the McpServer instance with name 'create-draft'.
    server.tool(
      "create-draft",
      "📝 CREATE DRAFT: Save a message as draft for later editing or sending. For user IDs in the 'to' field, use search-users or get-users tool to discover available users and their IDs.",
      CreateDraftSchema.shape,
      async ({ type, to, topic, content, timestamp }) => {
        try {
          const result = await zulipClient.createDraft({
            type,
            to,
            topic,
            content,
            timestamp
          });
          return createSuccessResponse(JSON.stringify({
            success: true,
            draft_ids: result.ids,
            message: `Draft created successfully! IDs: ${result.ids.join(', ')}`
          }, null, 2));
        } catch (error) {
          return createErrorResponse(`Error creating draft: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • TypeScript type alias CreateDraftParams inferred from the Zod schema.
    export type CreateDraftParams = z.infer<typeof CreateDraftSchema>;
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses that the tool saves a draft for later editing/sending and notes the topic requirement from the schema, but lacks details on permissions, rate limits, success/failure behavior, or how to later send the draft.

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 is two sentences, front-loaded, and efficient. Minor stylistic fluff (emoji, all-caps) does not detract significantly.

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?

With 5 parameters, no output schema, and no annotations, the tool description is incomplete. It explains purpose and gives a usage tip but omits return values, error handling, and lifecycle context (e.g., how to later send the draft).

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?

Schema description coverage is 100%, so baseline is 3. The description adds a tip about user IDs but otherwise does not enrich parameter understanding beyond what the schema already provides.

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 ('save a message as draft') and resource ('draft'), distinguishing it from send-message and edit-draft. However, it does not explicitly differentiate from create-scheduled-message, missing a chance to clarify scope.

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 a specific, actionable guideline: use search-users or get-users to find user IDs for the 'to' field. It does not, however, explain when not to use this tool or mention alternatives for similar tasks.

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