Skip to main content
Glama
fav-devs

Sociona MCP Server

by fav-devs

publish_post

Publish social media posts immediately to X, Instagram, or Threads with optional media attachments using the Sociona MCP Server.

Instructions

Publish a social media post immediately

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformYesSocial media platform
contentYesPost content/text
mediaUrlsNoOptional media URLs to attach

Implementation Reference

  • The handler function that implements the core logic for publishing a post. It retrieves connected accounts, validates the platform account exists, makes a POST request to the Sociona API /posts endpoint, and returns a success message with post details.
    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}`,
          },
        ],
      };
    }
  • Input schema defining the parameters for the publish_post tool: platform (X, INSTAGRAM, THREADS), content (required), and optional mediaUrls.
    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)
    Registration of the publish_post tool in the ListTools response, including name, description, and input schema.
    {
      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'],
      },
    },
  • src/index.ts:138-139 (registration)
    Registration of the publish_post handler in the CallToolRequest switch statement, dispatching to the publishPost method.
    case 'publish_post':
      return await this.publishPost(args);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fav-devs/sociona-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server