publish_post
Publish social media posts immediately to X, Instagram, or Threads with text content and optional media attachments.
Instructions
Publish a social media post immediately
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Post content/text | |
| mediaUrls | No | Optional media URLs to attach | |
| platform | Yes | Social media platform |
Implementation Reference
- src/index.ts:225-248 (handler)The main handler function that executes the publish_post tool. It retrieves connected accounts, validates the platform account exists, and sends a POST request to the Sociona API /posts endpoint to publish the post immediately.private async publishPost(args: any) { const { accounts } = await this.apiRequest('GET', '/accounts'); const account = accounts.find((a: any) => a.provider === args.platform); if (!account) { throw new Error(`No ${args.platform} account connected. Available accounts: ${accounts.map((a: any) => a.provider).join(', ')}`); } const result = await this.apiRequest('POST', '/posts', { accountId: account.id, platform: args.platform, content: args.content, mediaUrls: args.mediaUrls || [], }); return { content: [ { type: 'text', text: `✅ Post published to ${args.platform}!\nStatus: ${result.post.status}\nPost ID: ${result.post.id}`, }, ], }; }
- src/index.ts:35-54 (schema)Input schema definition for the publish_post tool, specifying required platform and content fields, optional mediaUrls, used for validation in tool calls.inputSchema: { type: 'object', properties: { platform: { type: 'string', enum: ['X', 'INSTAGRAM', 'THREADS'], description: 'Social media platform', }, content: { type: 'string', description: 'Post content/text', }, mediaUrls: { type: 'array', items: { type: 'string' }, description: 'Optional media URLs to attach', }, }, required: ['platform', 'content'], },
- src/index.ts:32-55 (registration)Tool registration in the ListToolsRequestSchema handler, providing the tool name, description, and input schema for clients to discover and use the publish_post tool.{ name: 'publish_post', description: 'Publish a social media post immediately', inputSchema: { type: 'object', properties: { platform: { type: 'string', enum: ['X', 'INSTAGRAM', 'THREADS'], description: 'Social media platform', }, content: { type: 'string', description: 'Post content/text', }, mediaUrls: { type: 'array', items: { type: 'string' }, description: 'Optional media URLs to attach', }, }, required: ['platform', 'content'], }, },