Skip to main content
Glama

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
NameRequiredDescriptionDefault
contentYesPost content/text
mediaUrlsNoOptional media URLs to attach
platformYesSocial media platform

Implementation Reference

  • 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}`, }, ], }; }
  • 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'], }, },

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