create_social_media_post
Create and manage social media posts across multiple platforms including Facebook, Instagram, TikTok, LinkedIn, and YouTube with platform-specific settings, scheduling, and media attachments.
Instructions
Create a new social media post with platform-specific settings for Google, TikTok, Threads, YouTube, Facebook, LinkedIn, Instagram, and Pinterest
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Post message/content | |
| accountId | Yes | Social media account ID | |
| action | Yes | Action to perform with the post | |
| date | No | Scheduled date for the post (format: YYYY-MM-DD HH:MM) | |
| media | No | Media file URLs to attach to the post | |
| additional | No | Platform-specific post settings and metadata |
Implementation Reference
- The async handler function that implements the core logic of the 'create_social_media_post' tool. It prepares the post data with action, message, account ID, date, media, and additional platform-specific settings, then sends a POST request to the Simplified API endpoint '/api/v1/service/social-media/create'. Returns structured success/error responses..handler(async (params, apiClient) => { if (!apiClient) { throw new AppError( ErrorType.TOOL_ERROR, 'API client not available - server configuration error' ); } try { // Format the date if provided let formattedDate = null; if (params.date) { formattedDate = params.date; } // Prepare the payload according to the API specification const postData = { action: params.action, message: params.message.trim(), account_ids: [params.accountId], date: formattedDate, media: params.media || [], additional: params.additional || {} }; // Always use the specified endpoint const response = await apiClient.post('/api/v1/service/social-media/create', postData); // Determine the action type for the response message const actionMessages = { schedule: 'scheduled', add_to_queue: 'added to queue', draft: 'saved as draft' }; const actionType = actionMessages[params.action as keyof typeof actionMessages] || 'processed'; return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Social media post ${actionType} successfully`, post: response.data, action: params.action, accountId: params.accountId, scheduledDate: formattedDate }, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: `Failed to create social media post: ${errorMessage}` }, null, 2) } ] }; } })
- The input schema definition for the tool, specified using the fluent ToolDefinitionBuilder API. Includes required fields: message, accountId, action; optional: date, media, and a complex 'additional' object with nested schemas for each social media platform (Google, TikTok, etc.)..name('create_social_media_post') .description('Create a new social media post with platform-specific settings for Google, TikTok, Threads, YouTube, Facebook, LinkedIn, Instagram, and Pinterest') .category('social-media') .version('1.1.0') .requiredString('message', 'Post message/content', { minLength: 1, maxLength: 5000 }) .requiredString('accountId', 'Social media account ID', { minLength: 1, maxLength: 100 }) .requiredString('action', 'Action to perform with the post', { enum: ['schedule', 'add_to_queue', 'draft'] }) .optionalString('date', 'Scheduled date for the post (format: YYYY-MM-DD HH:MM)', { pattern: '^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$' }) .optionalArray('media', 'Media file URLs to attach to the post', { type: 'string', pattern: '^https?://.+' }, { maxItems: 10 }) .optionalObject('additional', 'Platform-specific post settings and metadata', { // Google Business Profile google: { type: 'object', properties: { post: { type: 'object', properties: { title: { type: 'string', maxLength: 300 }, topicType: { type: 'string', enum: ['STANDARD', 'EVENT', 'OFFER', 'PRODUCT'] }, couponCode: { type: 'string', maxLength: 50 }, callToActionUrl: { type: 'string', pattern: '^https?://.+' }, redeemOnlineUrl: { type: 'string', pattern: '^https?://.+' }, termsConditions: { type: 'string', maxLength: 1000 }, callToActionType: { type: 'string', enum: ['SIGN_UP', 'LEARN_MORE', 'BOOK', 'ORDER', 'SHOP', 'CALL', 'GET_OFFER'] } } } } }, // TikTok / TikTok Business tiktok: { type: 'object', properties: { post: { type: 'object', properties: { brandContent: { type: 'boolean' }, brandOrganic: { type: 'boolean' }, duetDisabled: { type: 'boolean' }, privacyStatus: { type: 'string', enum: ['PUBLIC_TO_EVERYONE', 'MUTUAL_FOLLOW_FRIEND', 'FOLLOWER_OF_CREATOR', 'SELF_ONLY'] }, stitchDisabled: { type: 'boolean' }, commentDisabled: { type: 'boolean' } } }, channel: { type: 'object', properties: { value: { type: 'string', enum: ['direct', 'business'] } } }, postType: { type: 'object', properties: { value: { type: 'string', enum: ['video', 'image'] } } }, postPhoto: { type: 'object', properties: { title: { type: 'string', maxLength: 150 }, brandContent: { type: 'boolean' }, brandOrganic: { type: 'boolean' }, duetDisabled: { type: 'boolean' }, privacyStatus: { type: 'string', enum: ['PUBLIC_TO_EVERYONE', 'MUTUAL_FOLLOW_FRIEND', 'FOLLOWER_OF_CREATOR', 'SELF_ONLY'] }, stitchDisabled: { type: 'boolean' }, commentDisabled: { type: 'boolean' } } } } }, // Threads threads: { type: 'object', properties: { channel: { type: 'object', properties: { value: { type: 'string', enum: ['direct'] } } } } }, // YouTube youtube: { type: 'object', properties: { post: { type: 'object', properties: { title: { type: 'string', maxLength: 100 }, license: { type: 'string', enum: ['standard', 'creativeCommon'] }, privacyStatus: { type: 'string', enum: ['public', 'private', 'unlisted'] }, selfDeclaredMadeForKids: { type: 'string', enum: ['yes', 'no'] } } }, postType: { type: 'object', properties: { value: { type: 'string', enum: ['short', 'video'] } } } } }, // Facebook facebook: { type: 'object', properties: { postType: { type: 'object', properties: { value: { type: 'string', enum: ['story', 'feed', 'reel'] } } } } }, // LinkedIn linkedin: { type: 'object', properties: { audience: { type: 'object', properties: { value: { type: 'string', enum: ['PUBLIC', 'CONNECTIONS', 'LOGGED_IN_MEMBERS'] } } } } }, // Instagram instagram: { type: 'object', properties: { postReel: { type: 'object', properties: { audioName: { type: 'string', maxLength: 100 }, shareToFeed: { type: 'boolean' } } }, postType: { type: 'object', properties: { value: { type: 'string', enum: ['post', 'reel', 'story'] } } } } }, // Pinterest pinterest: { type: 'object', properties: { post: { type: 'object', properties: { link: { type: 'string', pattern: '^https?://.+' }, title: { type: 'string', maxLength: 100 }, imageAlt: { type: 'string', maxLength: 500 } } } } }, // Legacy fields for backward compatibility hashtags: { type: 'array', items: { type: 'string', maxLength: 50 }, maxItems: 30 }, mentions: { type: 'array', items: { type: 'object', properties: { username: { type: 'string' }, displayName: { type: 'string' } }, required: ['username'] }, maxItems: 20 }, location: { type: 'string', maxLength: 100 }, settings: { type: 'object', properties: { enableComments: { type: 'boolean' }, enableSharing: { type: 'boolean' }, targetAudience: { type: 'string', enum: ['public', 'friends', 'custom'] } } } })
- src/server.ts:128-131 (registration)Registration of the 'create_social_media_post' tool (included in socialMediaTools array) into the central ToolRegistry during SimplifiedMCPServer initialization in the registerDefaultTools method.// Register social media tools for (const tool of socialMediaTools) { this.toolRegistry.registerTool(tool); }