Skip to main content
Glama

create-draft

Save messages as drafts in Zulip for later editing or sending, supporting both stream channels and private conversations with proper user/channel ID configuration.

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

  • src/server.ts:688-710 (registration)
    Registers the MCP tool 'create-draft' with description, input schema (CreateDraftSchema), and handler function that delegates to ZulipClient.createDraft and formats MCP 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 defining input parameters for the create-draft tool, used for validation in MCP server.tool registration.
    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: core implementation that constructs the draft payload and makes the POST /drafts API call to Zulip server.
    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;
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that drafts are saved 'for later editing or sending', which implies persistence and mutability. However, it doesn't mention authentication requirements, rate limits, error conditions, or what happens if duplicate drafts are created. The description adds some behavioral context but leaves significant gaps.

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 appropriately sized with two sentences. The first sentence states the core purpose, and the second provides important usage guidance about user IDs. There's no wasted text, though the emoji at the beginning is decorative rather than functional.

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?

For a creation tool with no annotations and no output schema, the description provides adequate but incomplete context. It covers the basic purpose and some usage guidance, but lacks information about return values, error handling, permissions, or system behavior. The 100% schema coverage helps, but behavioral transparency remains limited.

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 the schema already documents all 5 parameters thoroughly. The description adds minimal value beyond the schema - it only mentions the 'to' field requires user IDs from other tools. This meets the baseline of 3 when schema coverage is high, but doesn't provide additional semantic context for other parameters.

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

Purpose5/5

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

The description clearly states the verb ('save a message as draft') and resource ('message'), distinguishing it from sibling tools like 'send-message' or 'edit-draft'. It specifies the purpose is for 'later editing or sending', which differentiates it from immediate message sending tools.

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 explicit guidance on when to use this tool ('save a message as draft for later editing or sending') and references alternative tools for discovering user IDs ('search-users or get-users tool'). However, it doesn't explicitly state when NOT to use this tool or compare it to all relevant siblings like 'create-scheduled-message'.

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