get_scheduled_drafts
Fetch recently scheduled Twitter drafts from Typefully to review or reschedule your upcoming posts.
Instructions
Get recently scheduled drafts from Typefully.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:120-133 (handler)The tool handler for 'get_scheduled_drafts' in the CallToolRequestSchema switch statement. Calls client.getScheduledDrafts() and formats the response.
case 'get_scheduled_drafts': { const drafts = await this.client.getScheduledDrafts(); return { content: [ { type: 'text', text: `Found ${drafts.length} scheduled drafts:\n\n${drafts .map((draft) => `ID: ${draft.id}\nContent: ${draft.content.substring(0, 100)}...\nScheduled: ${draft.scheduled_date}\n`) .join('\n')}`, }, ], }; } - src/client.ts:30-34 (helper)The TypefullyClient method getScheduledDrafts() that makes the HTTP GET to '/drafts/recently-scheduled/' and validates the response with GetDraftsResponseSchema.
async getScheduledDrafts(): Promise<Draft[]> { const response = await this.client.get('/drafts/recently-scheduled/'); const validatedResponse = GetDraftsResponseSchema.parse(response.data); return validatedResponse.drafts; } - src/server.ts:71-77 (registration)Tool registration listing in ListToolsRequestSchema handler, defining the tool name, description, and empty inputSchema.
name: 'get_scheduled_drafts', description: 'Get recently scheduled drafts from Typefully.', inputSchema: { type: 'object', properties: {}, }, }, - src/types.ts:11-24 (schema)Zod schemas for DraftSchema and GetDraftsResponseSchema used to validate the scheduled drafts response.
export const DraftSchema = z.object({ id: z.string(), content: z.string(), scheduled_date: z.string().nullable(), created_at: z.string(), updated_at: z.string(), share_url: z.string().optional(), auto_retweet_enabled: z.boolean().optional(), auto_plug_enabled: z.boolean().optional(), }); export const GetDraftsResponseSchema = z.object({ drafts: z.array(DraftSchema), });