create_draft
Create a new tweet or thread draft on Typefully; optionally schedule, split into multiple tweets, or enable auto-retweet and auto-plug.
Instructions
Create a new draft on Typefully. Supports single tweets and threads.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content of the tweet or thread. Use 4 consecutive newlines (\n\n\n\n) to separate tweets in a thread. | |
| threadify | No | Automatically split content into tweets if it exceeds character limits. | |
| schedule_date | No | ISO date string for scheduling the tweet (e.g., "2024-12-25T10:00:00Z"). | |
| auto_retweet_enabled | No | Enable automatic retweet. | |
| auto_plug_enabled | No | Enable automatic plug. |
Implementation Reference
- src/server.ts:95-118 (handler)The core handler for the 'create_draft' tool. Extracts arguments (content, threadify, schedule_date, auto_retweet_enabled, auto_plug_enabled) from the MCP request, maps them to a CreateDraftRequest, calls this.client.createDraft(), and returns a formatted success response.
case 'create_draft': { if (!args) { throw new McpError(ErrorCode.InvalidParams, 'Arguments are required'); } const draftRequest: CreateDraftRequest = { content: args.content as string, threadify: args.threadify as boolean | undefined, 'schedule-date': args.schedule_date as string | undefined, auto_retweet_enabled: args.auto_retweet_enabled as boolean | undefined, auto_plug_enabled: args.auto_plug_enabled as boolean | undefined, }; const draft = await this.client.createDraft(draftRequest); return { content: [ { type: 'text', text: `Draft created successfully!\n\nID: ${draft.id}\nContent: ${draft.content}\nScheduled: ${draft.scheduled_date || 'Not scheduled'}\nShare URL: ${draft.share_url || 'Not available'}`, }, ], }; } - src/types.ts:3-9 (schema)Zod validation schema for CreateDraftRequest, defining the shape and types of the request (content required string, optional threadify boolean, schedule-date string, auto_retweet_enabled boolean, auto_plug_enabled boolean).
export const CreateDraftRequestSchema = z.object({ content: z.string().min(1, 'Content is required'), threadify: z.boolean().optional(), 'schedule-date': z.string().optional(), auto_retweet_enabled: z.boolean().optional(), auto_plug_enabled: z.boolean().optional(), }); - src/server.ts:38-68 (registration)Tool registration in ListToolsRequestSchema handler. Defines the tool name 'create_draft', description, input schema (content required, plus optional parameters threadify, schedule_date, auto_retweet_enabled, auto_plug_enabled).
name: 'create_draft', description: 'Create a new draft on Typefully. Supports single tweets and threads.', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'The content of the tweet or thread. Use 4 consecutive newlines (\\n\\n\\n\\n) to separate tweets in a thread.', }, threadify: { type: 'boolean', description: 'Automatically split content into tweets if it exceeds character limits.', default: false, }, schedule_date: { type: 'string', description: 'ISO date string for scheduling the tweet (e.g., "2024-12-25T10:00:00Z").', }, auto_retweet_enabled: { type: 'boolean', description: 'Enable automatic retweet.', default: false, }, auto_plug_enabled: { type: 'boolean', description: 'Enable automatic plug.', default: false, }, }, required: ['content'], }, - src/client.ts:23-28 (helper)Client method that validates the request with CreateDraftRequestSchema and makes the HTTP POST to Typefully's /drafts/ API endpoint, returning the Draft response.
async createDraft(request: CreateDraftRequest): Promise<Draft> { const validatedRequest = CreateDraftRequestSchema.parse(request); const response = await this.client.post('/drafts/', validatedRequest); return response.data; }