get_published_drafts
Retrieve recently published drafts from Typefully to review and manage your published content.
Instructions
Get recently published drafts from Typefully.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:135-148 (handler)Handler for 'get_published_drafts' tool in the CallToolRequestSchema switch statement. Calls client.getPublishedDrafts() and formats the response as a text content block showing draft ID, content (truncated to 100 chars), and created_at.
case 'get_published_drafts': { const drafts = await this.client.getPublishedDrafts(); return { content: [ { type: 'text', text: `Found ${drafts.length} published drafts:\n\n${drafts .map((draft) => `ID: ${draft.id}\nContent: ${draft.content.substring(0, 100)}...\nCreated: ${draft.created_at}\n`) .join('\n')}`, }, ], }; } - src/client.ts:36-40 (helper)Client method getPublishedDrafts() that calls the Typefully API endpoint GET /drafts/recently-published/, validates the response with GetDraftsResponseSchema, and returns the drafts array.
async getPublishedDrafts(): Promise<Draft[]> { const response = await this.client.get('/drafts/recently-published/'); const validatedResponse = GetDraftsResponseSchema.parse(response.data); return validatedResponse.drafts; } - src/types.ts:22-24 (schema)GetDraftsResponseSchema used to validate the API response for get_published_drafts. Contains a 'drafts' array of DraftSchema objects.
export const GetDraftsResponseSchema = z.object({ drafts: z.array(DraftSchema), }); - src/server.ts:78-85 (registration)Tool registration for 'get_published_drafts' in the ListToolsRequestSchema handler. Defines the tool name, description ('Get recently published drafts from Typefully.'), and inputSchema (empty object, no parameters).
{ name: 'get_published_drafts', description: 'Get recently published drafts from Typefully.', inputSchema: { type: 'object', properties: {}, }, },